I have a data model from importing data from multiple excel sheets via Power Query and I am generating Measures in Power Pivot for the count of Type. My data table looks like the left table in the following image and I want to transform it into a Pivot table to display the sum of the types for each milestone per quarter.
I tried to set up a quarter table and link it to the left table but i am not able to link it to multiple columns (as the quarters are referenced in each milestone column). Is here a way to get achieve this result in Power Pivot or Power Query and display it in a way as seen on the right side of the image?
Here is a Power Query option that unpivots 'Milestone' columns to produce a table conducive to generating an appropriate Pivot Table.
Once the data is loaded into PowerQuery:
This should be the resulting table:
Load the above resulting table to a PivotTable which results in the Pivot Table below (note: I renamed the 'Value' column to 'Period'):
For the sake of reproducibility, here is the M Code:
let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Type", type text}, {"Milestone 1", type text}, {"Milestone 2", type text}, {"Milestone 3", type text}}),
#"Unpivoted Columns" = Table.UnpivotOtherColumns(#"Changed Type", {"Type"}, "Attribute", "Value"),
#"Renamed Columns" = Table.RenameColumns(#"Unpivoted Columns",{{"Value", "Period"}}),
#"Add Count Column" = Table.AddColumn(#"Renamed Columns", "Count", each 1, Int64.Type)
in
#"Add Count Column"