Forum Discussion
Relative time measures with Dynamic Time axis
- 3 years ago
amitchandak it was not an option since I'm using a live connection to AAS, but I managed to resolve this issue.
I created a table 'DatesWithPartsYear' that combines dates, DisplayDates, PartOfYear as a seperate table (no connection to the model) and then re-caluclated my measure for this report to.
In DateTable I created additional columns "Year Month" and "Year Quarter" - to follow the same data schema as in DatesWithPartsYear. then in my measers I added TREATAS - to treat my displayDate as a specific column from ch_date depends on context ot PartYear.
Actual = SWITCH( VALUES ( DatesWithPartsYear[PartYear] ), "Month", CALCULATE( SUM(factTable[Value]), factTable[MeasureTypeName] = "Actual", TREATAS ( VALUES ( v_DatesWithPartsYear[DisplayDate] ) , dateTable[Year Month]) ), "Quarter", CALCULATE( SUM(factTable[Value]), factTable[MeasureTypeName] = "Actual", TREATAS ( VALUES ( DatesWithPartsYear[DisplayDate] ) , dateTable[Year Quarter]) ) )
mrklucz , You can use field parameters
Power BI Field Parameters — A Quick way for Dynamic Visuals: https://amitchandak.medium.com/power-bi-field-parameters-a-quick-way-for-dynamic-visuals-fc4095ae9afd
Power BI Field Parameters- Measure Slicer and Axis/Dimension slicer: https://youtu.be/lqF3Wa1FllE
Switch TOPN with Field Parameters: https://amitchandak.medium.com/switch-topn-with-field-parameters-299a0ae3725f
amitchandak it was not an option since I'm using a live connection to AAS, but I managed to resolve this issue.
I created a table 'DatesWithPartsYear' that combines dates, DisplayDates, PartOfYear as a seperate table (no connection to the model) and then re-caluclated my measure for this report to.
In DateTable I created additional columns "Year Month" and "Year Quarter" - to follow the same data schema as in DatesWithPartsYear. then in my measers I added TREATAS - to treat my displayDate as a specific column from ch_date depends on context ot PartYear.
Actual =
SWITCH(
VALUES ( DatesWithPartsYear[PartYear] ),
"Month",
CALCULATE(
SUM(factTable[Value]),
factTable[MeasureTypeName] = "Actual",
TREATAS ( VALUES ( v_DatesWithPartsYear[DisplayDate] ) , dateTable[Year Month])
),
"Quarter",
CALCULATE(
SUM(factTable[Value]),
factTable[MeasureTypeName] = "Actual",
TREATAS ( VALUES ( DatesWithPartsYear[DisplayDate] ) , dateTable[Year Quarter])
)
)