We're giving away 30 tickets for FREE! Share your story, your vision, or your hustle and tell us why YOU deserve a ticket.
Apply nowWin a FREE 3 Day Ticket to FabCon Vienna. Apply now
Hi,
I'm trying to add a custom column using the sum of a large (undefined) number of previous columns.
Based on a similar use-case I've read about I was trying the following code:
The idea is to list all the columns beginning with "Id_" and using this list to add in the "add" statement.
Using this code I'm generating the list:
The following Error occurse :
But also adapting to code to:
SumRows = Table.AddColumn(#"Pivoted Column", "Addition", each (ColumnsToSum))
or SumRows = Table.AddColumn(#"Pivoted Column", "Addition", each ({ColumnsToSum}) is not successful
Any ideas if this could work and if I have a mistake in my code or does this "using a list to add a large number of columns" not work at all.
appreciate some feedback 🙂
Solved! Go to Solution.
Hi @fishboneox,
Add an [Index] first.
Add a custom column like this:
= Table.AddColumn(#"Added Index", "Total", each List.Sum(List.Select(Record.FieldValues(#"Promoted Headers"{[Index]}),each _ is number)))
Best regards,
Yuliana Gu
Hi @fishboneox,
Add an [Index] first.
Add a custom column like this:
= Table.AddColumn(#"Added Index", "Total", each List.Sum(List.Select(Record.FieldValues(#"Promoted Headers"{[Index]}),each _ is number)))
Best regards,
Yuliana Gu
Thanks for your support. This works perfectly 😉
User | Count |
---|---|
63 | |
59 | |
46 | |
35 | |
32 |
User | Count |
---|---|
85 | |
71 | |
57 | |
51 | |
46 |