Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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 😉
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
72 | |
70 | |
37 | |
29 | |
26 |
User | Count |
---|---|
91 | |
49 | |
44 | |
38 | |
37 |