Forum Discussion
Dax help- Take value from multiple columns and create single column with multiple rows
- Anonymous2 years ago
Hi sbw666 ,
Based on the information you have provided, you can follow the steps below:
1.Unpivoted Row1, Row2 and Row3 in Power Query.
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUXJOLElNzy+qVEDhGCFzjJVidaKVjHDKmwA5YCVmyKKmIFGQRCwA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Invoice Type" = _t, Row1 = _t, Row2 = _t, Row3 = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"Invoice Type", Int64.Type}, {"Row1", type text}, {"Row2", type text}, {"Row3", type text}}), #"Unpivoted Columns" = Table.UnpivotOtherColumns(#"Changed Type", {"Invoice Type"}, "Attribute", "Value"), #"Removed Bottom Rows" = Table.RemoveLastN(#"Unpivoted Columns",2), #"Removed Alternate Rows" = Table.AlternateRows(#"Removed Bottom Rows",5,1,6), #"Renamed Columns" = Table.RenameColumns(#"Removed Alternate Rows",{{"Value", "Category"}}), #"Removed Columns" = Table.RemoveColumns(#"Renamed Columns",{"Attribute"}) in #"Removed Columns"2.Use measure to calculate Total Amount by Invoice Type.
Total Amount = CALCULATE ( SUM ( Table3[Amount] ), FILTER ( ALL ( 'Table' ), 'Table'[Invoice Type] = SELECTEDVALUE ( 'Table'[Invoice Type] ) ) )Final output:
How to Get Your Question Answered Quickly - Microsoft Fabric Community
If it does not help, please provide more details with your desired out put and pbix file without privacy information.
Best Regards,
Ada Wang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi sbw666 ,
Based on the information you have provided, you can follow the steps below:
1.Unpivoted Row1, Row2 and Row3 in Power Query.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUXJOLElNzy+qVEDhGCFzjJVidaKVjHDKmwA5YCVmyKKmIFGQRCwA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Invoice Type" = _t, Row1 = _t, Row2 = _t, Row3 = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Invoice Type", Int64.Type}, {"Row1", type text}, {"Row2", type text}, {"Row3", type text}}),
#"Unpivoted Columns" = Table.UnpivotOtherColumns(#"Changed Type", {"Invoice Type"}, "Attribute", "Value"),
#"Removed Bottom Rows" = Table.RemoveLastN(#"Unpivoted Columns",2),
#"Removed Alternate Rows" = Table.AlternateRows(#"Removed Bottom Rows",5,1,6),
#"Renamed Columns" = Table.RenameColumns(#"Removed Alternate Rows",{{"Value", "Category"}}),
#"Removed Columns" = Table.RemoveColumns(#"Renamed Columns",{"Attribute"})
in
#"Removed Columns"
2.Use measure to calculate Total Amount by Invoice Type.
Total Amount =
CALCULATE (
SUM ( Table3[Amount] ),
FILTER (
ALL ( 'Table' ),
'Table'[Invoice Type] = SELECTEDVALUE ( 'Table'[Invoice Type] )
)
)
Final output:
How to Get Your Question Answered Quickly - Microsoft Fabric Community
If it does not help, please provide more details with your desired out put and pbix file without privacy information.
Best Regards,
Ada Wang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.