[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

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand

Forum statistics

Threads
1,216,721
Messages
6,132,314
Members
449,718
Latest member
Marie42719

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