Hi Team,
I have a set of certain metrics with Actual Values in one column and Target Values in second column, for every month.
I cannot figure out how to display those 2 values for each corresponding month side by side. For example: Target and Actual for April should be in one row.
Solved! Go to Solution.
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,
@Riddlemirror , if you are sure there is only one value per month, use group by and take the max of both columns
https://docs.microsoft.com/en-us/power-query/group-by
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,
Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!
User | Count |
---|---|
107 | |
74 | |
66 | |
50 | |
48 |
User | Count |
---|---|
168 | |
88 | |
78 | |
72 | |
67 |