Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
theo
Helper III
Helper III

sum multiple columns, how to?

Hi, Im new in powerBi and Im working in some datat wherein I need to calculate per row with multiple colums.

at 1 row for example, i have data like           1.00     1.25    2.00  3.00   4.50   5.00

now i have to add this, manually i can do it by saying column a + column b.... etc.  but i dont know how to compute via sum

i tried sumx but i have error that says - The expression refers to multiple columns. Multiple columns cannot be converted to a scalar value.

thanks for the help.

 

1 ACCEPTED SOLUTION
magsod
Solution Supplier
Solution Supplier

Have you tried the proper syntax using SUMX?

MeassureName = SUMX(TableName, TableName[column a] +TableName[column b] +TableName[column c] ...)

 

That should do the trick.

 

Br,

Magnus

View solution in original post

8 REPLIES 8
ZDBobbitt
Frequent Visitor

This tutorial shows an example of how to do so: https://www.statology.org/power-bi-sum-multiple-columns/

Thiyags
Helper II
Helper II

Thank you Thiyags.

I actually have used that manual iteration but am looking for some sum formula.

would like also to do similar calculation like standard deviation by row, etc.

magsod
Solution Supplier
Solution Supplier

Have you tried the proper syntax using SUMX?

MeassureName = SUMX(TableName, TableName[column a] +TableName[column b] +TableName[column c] ...)

 

That should do the trick.

 

Br,

Magnus

I have tried this formula but its showing over all value in every cell of that column

 

89hasnain_0-1687870361694.png

 

Calculate(SUMX(TableName, TableName[column a] +TableName[column b] +TableName[column c] ...) thias would work

Anonymous
Not applicable

Hi,

The same syntax i used for summing up the data in my table, but it is summing up data of individual column first and then adding to summed up data of another column.

Please Suggest any solution if you have on this. 

In addition to Magnus' correct recommendation, you may also like to consider unpivoting your data into a single column of values.

 

ID, A, B, C, D, E

1, 5, 7, 5, 6, 3

2, 3, 9, 2, 6, 4

 

Is better stored like this

 

ID, Type, Value

1, A, 5

1, B, 7

1, C, 5

1, D, 6

1, E, 4

2, A, 3

2, B, 9

2, C, 2

2, D, 6

2, E, 4

 

This second design will be much more performant and compressed.  You can then also use a simple SUM(Table[Value])



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.