Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register 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 😉
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
65 | |
63 | |
52 | |
37 | |
36 |
User | Count |
---|---|
82 | |
66 | |
61 | |
46 | |
45 |