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 would like to create the sum of a value column in PowerQuery. The value column is formatted as a number (decimals).
I thought this info would do the trick:
Solved: Calculate sum of column in query editor - Microsoft Power BI Community
However, the formula "List.Sum([Value])" gives me the following error:
"Expression.Error: We cannot convert the value 1 to type List.
Details:
Value=1
Type=[Type]"
I also tried the following formula "List.Sum(#"Changed Type"[Value])" (as mentioned in the link above but I am not sure what the "changed type" part does here) but that formula give me the following error:
"Expression.Error: The name 'Changed Type' wasn't recognized. Make sure it's spelled correctly."
What am I doing wrong here? How can I create a new column which displays the total sum of the value column next to my current data (but that keeps all my rows in the table the same).
Thank you for your help!
Thanks for sharing, it helped me the first time I tried it.
@Anonymous Try:
List.Sum(Table.Column(#"PreviousRow", "Value"))
#"PreviousRow" is the step in your query you want to reference. If the column is Value, then use "Value", otherwise use the name of your column as text like "Column1".
This seems part of the solution, but it is not the entire solution yet.
My formula I used with the above feedback is:
= List.Sum(Table.Column(#"Changed Type1", "Value"))
(Changed Type 1 is my previous step in powerquery)
This makes all my rows and all my columns disappear and only the number (238) is displayed. This is the right number, but I need to have it displayed in a new seperate column in my table where on each row of that new column the number 238 is displayed.
Thank you for your feedback!
Hi, @Anonymous
How did you add the custom column?
Please select feature 'custom column' then add the code as below:
Sample (M code):
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlSK1YlWMgKTxmDSBEyagkkzMGkOJi3ApCWYNDRQio0FAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Value = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Value", Int64.Type}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each List.Sum(Table.Column(#"Changed Type", "Value")))
in
#"Added Custom"
Best Regards,
Community Support Team _ Eason
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 |
---|---|
68 | |
53 | |
53 | |
36 | |
34 |
User | Count |
---|---|
84 | |
71 | |
55 | |
45 | |
43 |