We're giving away 30 tickets for FREE! Share your story, your vision, or your hustle and tell us why YOU deserve a ticket.
Apply nowWin a FREE 3 Day Ticket to FabCon Vienna. Apply now
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.
Solved! Go to Solution.
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
Thanks & Regards
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:
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 _
)
)
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
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.
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:
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 _
)
)
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
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.
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
Thanks & Regards
User | Count |
---|---|
64 | |
59 | |
46 | |
35 | |
33 |
User | Count |
---|---|
86 | |
84 | |
70 | |
49 | |
46 |