Forum Discussion
Percentage difference between periods that change with date granularity on graph
Hi W4LTZ ,
Modify your formula like below:
% Change - Dynamic =
IF (
ISFILTERED ( 'Scrapped'[Scrap Date] ),
ERROR ( "Time intelligence quick measures can only be grouped or filtered by the Power BI-provided date hierarchy or primary date column." ),
VAR __PREV_PERIOD =
CALCULATE (
AVERAGE ( 'Scrapped'[Hours] ),
DATESINPERIOD (
'Scrapped'[Scrap Date].[Date],
MIN ( 'Scrapped'[Scrap Date].[Date] ),
-1,
MONTH
)
)
RETURN
DIVIDE ( AVERAGE ( 'Scrapped'[Total Hours] ) - __PREV_PERIOD, __PREV_PERIOD )
)
If it does not work please provide test data and explain.
Best Regards,
Adamk Kong
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi Anonymous / Adam,
Thank you so much for your attention.
I have tried your formula suggestion and it doesn't seem to work for neither month or quarters.
I have detailed the information in the test file below.
https://www.dropbox.com/scl/fi/3e09g37687v5h6qh3jrwp/Test.pbix?rlkey=0vwtmrvgtc78oh8lrpy9pu06w&dl=0
The visuals now look like the below. Basically i need the % change from the previous period to be consistent with the date hierachy shown.
Hope this helps and that the dropbox link works. Please feel free to ask any questions.
Cheers
Walt