Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
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 |
---|---|
139 | |
113 | |
103 | |
73 | |
63 |
User | Count |
---|---|
136 | |
125 | |
107 | |
70 | |
61 |