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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Calculate sum across many columns per row

Hello,

I have the following table in Power BI and i am looking for a simple or easy way to sum across columns per row.

For example, i have 3 columns to sum into a fourth column per row. But it becomes very complicated if i have 100's of columns to add. So, i am looking for an efficient and easy formula. I am wondering if this can be done in DAX using a measure or calculated column? Which is the best way? Is there an easy way to omit one or more specific columns from the sum?

 

Col1Col2Col3Sum
45615
73313
83314
82717
4228
36918
2349
103720
67821
32510
39315
76316

 

Any help is much appreciated!

1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

@Anonymous 
The best method is to unpivot the columns using power query https://we.tl/t-4Ssllc7A7P

1.png2.png3.png

@Anonymous This is the solution using DAX calculated table

1.png2.png

New Data1 = 
UNION (
    SELECTCOLUMNS ( Data1, "Index", [Index], "Column", "Col1", "Value", [Col1] ),
    SELECTCOLUMNS ( Data1, "Index", [Index], "Column", "Col2", "Value", [Col2] ),
    SELECTCOLUMNS ( Data1, "Index", [Index], "Column", "Col3", "Value", [Col3] )
)

View solution in original post

5 REPLIES 5
tamerj1
Super User
Super User

@Anonymous 
The best method is to unpivot the columns using power query https://we.tl/t-4Ssllc7A7P

1.png2.png3.png

@Anonymous This is the solution using DAX calculated table

1.png2.png

New Data1 = 
UNION (
    SELECTCOLUMNS ( Data1, "Index", [Index], "Column", "Col1", "Value", [Col1] ),
    SELECTCOLUMNS ( Data1, "Index", [Index], "Column", "Col2", "Value", [Col2] ),
    SELECTCOLUMNS ( Data1, "Index", [Index], "Column", "Col3", "Value", [Col3] )
)
Anonymous
Not applicable

@tamerj1 Thanks for your DAX solution. I have been doing more research and found maybe a simpler way. I tested the following in a calculated column and it seems to work?! But i am wondering if this could be simplified even more, by referencing the entire table instead of each column, one by one? This would be tedious and long to type for a table with 100 columns.

SumValues= [Col1]+[Col2]+[Col2]

 

@Anonymous 

 Unfortunately summing the columns one by one is the only solution. Having 100columns is extremely unusual and is a clear indication that there is something wrong in the structure of your data. Now you are suffering to have the sum but what about if you need to create a measure? Can you imagine having to duplicate each measure 100 times? Nobody does that. It should be only one attributes column and value column then everything would be just easy. 

Anonymous
Not applicable

@tamerj1 Thanks for your reply! I appreciate your solution but i am looking for an answer using DAX - is it possible?

@Anonymous 
Yes but it is not as simple as power query. I will update the solution in the first reply in few minutes.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors