Forum Discussion
Displaying Month Data side by side
- 4 years ago
Hi Riddlemirror ,
You need to perform the below steps to transform the table as per your expectation.
1. Unpivot the Actual and Target Columns
2. Filter the value column to exclude nulls
3. Pivot the Attribute column with Value column to be selected as value. You will have to change the aggregation from count to Max post this step
Source:
Target:
Insead use the below M Query to get this
let Source, #"Unpivoted Columns" = Table.UnpivotOtherColumns(Source, {"Month"}, "Attribute", "Value"), #"Filtered Rows" = Table.SelectRows(#"Unpivoted Columns", each ([Value] <> "null")), #"Pivoted Column" = Table.Pivot(#"Filtered Rows", List.Distinct(#"Filtered Rows"[Attribute]), "Attribute", "Value", List.Max) in #"Pivoted Column"Replace Source with your source details in the above M code
Regards,
Hi Riddlemirror ,
You need to perform the below steps to transform the table as per your expectation.
1. Unpivot the Actual and Target Columns
2. Filter the value column to exclude nulls
3. Pivot the Attribute column with Value column to be selected as value. You will have to change the aggregation from count to Max post this step
Source:
Target:
Insead use the below M Query to get this
let
Source,
#"Unpivoted Columns" = Table.UnpivotOtherColumns(Source, {"Month"}, "Attribute", "Value"),
#"Filtered Rows" = Table.SelectRows(#"Unpivoted Columns", each ([Value] <> "null")),
#"Pivoted Column" = Table.Pivot(#"Filtered Rows", List.Distinct(#"Filtered Rows"[Attribute]), "Attribute", "Value", List.Max)
in
#"Pivoted Column"
Replace Source with your source details in the above M code
Regards,