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

Win a FREE 3 Day Ticket to FabCon Vienna. Apply now

Reply
Tome_05
Helper III
Helper III

Please tell me how to add up the numbers for each column

Thank you as always.
If possible, please reply as soon as possible.

As shown in the attached image, I have the numbers in each column, but I would like to add up the numbers for each row and find the sum. Please tell me how to do this.

Thank you in advance.1.png

2 ACCEPTED SOLUTIONS
BIswajit_Das
Super User
Super User

Hello @Tome_05 
First solved the errors then
If you want to add the columns you can create a calculated column with dax like the below image
HEL1.png
Thanks & Regards

View solution in original post

Anonymous
Not applicable

Hi,BIswajit_Das ,thanks for your concern about this issue.
Your answer is excellent!
And I would like to share some additional solutions below.

Hello,@Tome_05 .I am glad to help you.
This is my test data
use Power Query M code:
 

vjtianmsft_0-1738302283405.png

As suggested by BIswajit_Das, you need to pre-process the null values in the columns you want to sum for each row of data (only specifying the null value to be 0 in the calculation, it doesn't affect the actual data)
Because in power query, if you don't handle null values, the final result will always be null.

This is the M code:

 

 

 

 

List.Sum(
            List.Transform(
                { [1], [2], [3], [4] }, 
                each if _ = null then 0 else _
            )
        )

 

 

 

 

vjtianmsft_1-1738302332281.png

let
    Source = Excel.Workbook(File.Contents("C:\Users\username\Desktop\test_1_31.xlsx"), null, true),
    TestData_Sheet = Source{[Item="TestData",Kind="Sheet"]}[Data],
    #"Changed Type" = Table.TransformColumnTypes(TestData_Sheet,{{"Column1", type any}, {"Column2", type text}, {"Column3", Int64.Type}, {"Column4", Int64.Type}, {"Column5", Int64.Type}, {"Column6", Int64.Type}}),
    #"Promoted Headers" = Table.PromoteHeaders(#"Changed Type", [PromoteAllScalars=true]),
    #"Changed Type1" = Table.TransformColumnTypes(#"Promoted Headers",{{"SID", Int64.Type}, {"Field", type text}, {"1", type number}, {"2", Int64.Type}, {"3", Int64.Type}, {"4", Int64.Type}}),
     #"Added Custom" = Table.AddColumn(#"Changed Type1", "SumOFValue", each List.Sum(
            List.Transform(
                { [1], [2], [3], [4] }, 
                each if _ = null then 0 else _
            )
        ))
in
    #"Added Custom"


Use DAX function

vjtianmsft_2-1738302431991.png

 


I hope my suggestions give you good ideas, if you have any more questions, please clarify in a follow-up reply.
Best Regards,
Carson Jian,
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi,BIswajit_Das ,thanks for your concern about this issue.
Your answer is excellent!
And I would like to share some additional solutions below.

Hello,@Tome_05 .I am glad to help you.
This is my test data
use Power Query M code:
 

vjtianmsft_0-1738302283405.png

As suggested by BIswajit_Das, you need to pre-process the null values in the columns you want to sum for each row of data (only specifying the null value to be 0 in the calculation, it doesn't affect the actual data)
Because in power query, if you don't handle null values, the final result will always be null.

This is the M code:

 

 

 

 

List.Sum(
            List.Transform(
                { [1], [2], [3], [4] }, 
                each if _ = null then 0 else _
            )
        )

 

 

 

 

vjtianmsft_1-1738302332281.png

let
    Source = Excel.Workbook(File.Contents("C:\Users\username\Desktop\test_1_31.xlsx"), null, true),
    TestData_Sheet = Source{[Item="TestData",Kind="Sheet"]}[Data],
    #"Changed Type" = Table.TransformColumnTypes(TestData_Sheet,{{"Column1", type any}, {"Column2", type text}, {"Column3", Int64.Type}, {"Column4", Int64.Type}, {"Column5", Int64.Type}, {"Column6", Int64.Type}}),
    #"Promoted Headers" = Table.PromoteHeaders(#"Changed Type", [PromoteAllScalars=true]),
    #"Changed Type1" = Table.TransformColumnTypes(#"Promoted Headers",{{"SID", Int64.Type}, {"Field", type text}, {"1", type number}, {"2", Int64.Type}, {"3", Int64.Type}, {"4", Int64.Type}}),
     #"Added Custom" = Table.AddColumn(#"Changed Type1", "SumOFValue", each List.Sum(
            List.Transform(
                { [1], [2], [3], [4] }, 
                each if _ = null then 0 else _
            )
        ))
in
    #"Added Custom"


Use DAX function

vjtianmsft_2-1738302431991.png

 


I hope my suggestions give you good ideas, if you have any more questions, please clarify in a follow-up reply.
Best Regards,
Carson Jian,
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

BIswajit_Das
Super User
Super User

Hello @Tome_05 
First solved the errors then
If you want to add the columns you can create a calculated column with dax like the below image
HEL1.png
Thanks & Regards

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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