Forum Discussion

Medmanage101's avatar
Medmanage101
Frequent Visitor
3 years ago
Solved

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 data:

 

 

  • 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.

2 Replies

  • You can either do this with DAX or Power Query. 
    For DAX, you can simply create a calculated column or measure that is something like: 

     

    NewColumnName = [Never Used] + [Not Used] + ... + [Always Used]

     

    Or you can go back into Power Query and select those 5 columns then Add Column > Standard > Add

     

  • 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.