[POWER QUERY] Additional column with summing all previous columns expect the first one

jarekjd

New Member
Joined
Jan 5, 2018
Messages
11
Hello Guys,

Pls help to adjust the code. Beginner struggles... :(

Power Query:
let
    Source = Csv.Document(Web.Contents("https://api.llama.fi/simpleChainDataset/Terra?"),[Delimiter=",", Columns=1160, Encoding=1252, QuoteStyle=QuoteStyle.None]),
    #"Transposed Table" = Table.Transpose(Source),
    #"Promoted Headers" = Table.PromoteHeaders(#"Transposed Table", [PromoteAllScalars=true]),
    #"Changed Type1" = Table.TransformColumnTypes(#"Promoted Headers",{{"Total", type number}, {"Terraswap", type number}, {"Protocol", type text}, {"Lido", type number}, {"Mirror", type number}, {"Anchor", type number}, {"Spectrum Protocol", type number}, {"LoTerra", type number}, {"Pylon Protocol", type number}, {"ApolloDAO", type number}, {"Nexus Protocol", type number}, {"Loop Finance", type number}, {"Starterra", type number}, {"Astroport", type number}, {"Stader", type number}}),
    #"Rows Total" = Table.AddColumn(Source, "Sum", each List.Sum(List.Range(Record.ToList(_),2,Table.ColumnCount(Source)-2)))
in
    #"Rows Total"


I'd like to do 2 things:
1) in #"Changed Type1" - dynamically provide type number to all column except the first one (this is date field)
- above code is referencing specific names but the number of columns is dynamic
2) in #"Rows Total" - add new column which is summing all columns except the first one (these are categories of data i dont need - just a sum of it)

As you can see before that i'm promoting headers from the first row so it should be taken into account.

Can you pls help? Appreciate a lot!
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying

Forum statistics

Threads
1,223,908
Messages
6,175,307
Members
452,633
Latest member
DougMo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top