Forum Discussion
Calculate table with loop
- 3 years ago
I suggest you change the structure of the original table in Power Query by pivoting the "Dimension" and "Quantity" columns as follows:
I would then suggest you create new dimension tables for Item using:
Item Table = SUMMARIZE('Source Table', 'Source Table'[item], 'Source Table'[item description])and for Year and Month following this pattern:
Fiscal Year Table = DISTINCT('Source Table'[FY])Set up the model using single direction one-to-many relationships between the dimension tables:
Create the measures you need following this pattern:
Ordered - forecast month = SUM('Source Table'[Ordered]) - SUM('Source Table'[forecast current month])Ordered - forecast m-1 = SUM('Source Table'[Ordered]) - SUM('Source Table'[forecast m-1])Finally set up a matrix using the fields from the dimension tables and the measures. In the formatting pane, under Values -> Options, turn on the option "Switch values on rows" to get:
Attached is the sample PBIX file
I suggest you change the structure of the original table in Power Query by pivoting the "Dimension" and "Quantity" columns as follows:
I would then suggest you create new dimension tables for Item using:
Item Table =
SUMMARIZE('Source Table', 'Source Table'[item], 'Source Table'[item description])
and for Year and Month following this pattern:
Fiscal Year Table = DISTINCT('Source Table'[FY])
Set up the model using single direction one-to-many relationships between the dimension tables:
Create the measures you need following this pattern:
Ordered - forecast month = SUM('Source Table'[Ordered]) - SUM('Source Table'[forecast current month])Ordered - forecast m-1 = SUM('Source Table'[Ordered]) - SUM('Source Table'[forecast m-1])
Finally set up a matrix using the fields from the dimension tables and the measures. In the formatting pane, under Values -> Options, turn on the option "Switch values on rows" to get:
Attached is the sample PBIX file