Forum Discussion
Medmanage101
3 years agoFrequent Visitor
Sum Column Cells, Not Columns - Help
I want to sum up the columns across, NOT down. What DAX writes this? I need a new column called "Score". My new column would read...0,0,2,2,3,3,0,0 etc. going down. Thank you for heping. Sample d...
- 3 years ago
Hi Medmanage101 ,
Approve with vicky_ ,
You can also use merge columns:
Output:
Here is the M code:
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlDSUUKgWB1sIhCmEREiQGSMW4QYu8gToYoLYwE=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [A = _t, B = _t, C = _t, D = _t, E = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"A", Int64.Type}, {"B", type text}, {"C", Int64.Type}, {"D", Int64.Type}, {"E", type text}}), #"Inserted Merged Column" = Table.AddColumn(#"Changed Type", "Merged", each Text.Combine({Text.From([A], "en-US"), Text.From([C], "en-US"), Text.From([D], "en-US")}, ""), type text), #"Renamed Columns" = Table.RenameColumns(#"Inserted Merged Column",{{"Merged", "Score"}}) in #"Renamed Columns"Best Regards,
Jianbo Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-jianboli-msft
Community Support
3 years agoHi Medmanage101 ,
Approve with vicky_ ,
You can also use merge columns:
Output:
Here is the M code:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlDSUUKgWB1sIhCmEREiQGSMW4QYu8gToYoLYwE=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [A = _t, B = _t, C = _t, D = _t, E = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"A", Int64.Type}, {"B", type text}, {"C", Int64.Type}, {"D", Int64.Type}, {"E", type text}}),
#"Inserted Merged Column" = Table.AddColumn(#"Changed Type", "Merged", each Text.Combine({Text.From([A], "en-US"), Text.From([C], "en-US"), Text.From([D], "en-US")}, ""), type text),
#"Renamed Columns" = Table.RenameColumns(#"Inserted Merged Column",{{"Merged", "Score"}})
in
#"Renamed Columns"
Best Regards,
Jianbo Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.