Forum Discussion
How to shift date axis using what-if parameter?
- 7 years ago
Anonymous
Here is my edited version of your PBIX.
link- First I created a parameter table DateOffset using Modelling => New Parameter.
- Added a slicer for this parameter as in your screenshot
- I also marked your DimDate table as a date table. This is best to do when you are using time intelligence functions.
- I created measures called Primary & Indicator, just for the sake of consistency with your earlier screenshot.
Indicator uses DATEADD to shift the date filter by the negative of the DateOffset value selected. This gives the appearance of shifting Indicator to the right if a positive DateOffset is selected.
Primary = AVERAGE ( 'Value by Date 1'[Value] ) Indicator = CALCULATE ( AVERAGE ( 'Value by Date 2'[Value] ), DATEADD ( DimDate[Date], -[DateOffset Value], MONTH ) )Regards,
Owen
Anonymous
I am assuming there are existing relationships between the Date columns of the Primary & Indicator tables and DimDate[Date].
My suggested measure doesn't require any new relationships to be created - it just shifts the filter on DimDate[Date] forward or backwards, for the purpose of that measure only. This relies on there already being a relationship between the Indicator table (table containing the values to be "shifted") and DimDate.
Did you have a working PBIX file that you could post a link to (similar to the screenshots you added to your original post), and I could create a sample measure within that model?
Otherwise, I could mock up a model to illustrate the technique.
Regards,
Owen
Here's an example file:
http://s000.tinyupload.com/index.php?file_id=31701397748373985624
Thanks!
Hiram
- OwenAuger7 years agoSuper User
Anonymous
Here is my edited version of your PBIX.
link- First I created a parameter table DateOffset using Modelling => New Parameter.
- Added a slicer for this parameter as in your screenshot
- I also marked your DimDate table as a date table. This is best to do when you are using time intelligence functions.
- I created measures called Primary & Indicator, just for the sake of consistency with your earlier screenshot.
Indicator uses DATEADD to shift the date filter by the negative of the DateOffset value selected. This gives the appearance of shifting Indicator to the right if a positive DateOffset is selected.
Primary = AVERAGE ( 'Value by Date 1'[Value] ) Indicator = CALCULATE ( AVERAGE ( 'Value by Date 2'[Value] ), DATEADD ( DimDate[Date], -[DateOffset Value], MONTH ) )Regards,
Owen
- Anonymous7 years agoNot applicable
This is perfect, thank you, OwenAuger!
- Anonymous5 years agoNot applicable
Love that solution, would be great to see a reupload of your file (or from anyone else if OP doesn't respond)!
- OwenAuger5 years agoSuper User
Anonymous
Just fixed the link in m post above 🙂
Thanks for pointing that out, as I will have to go back fix a bunch of others due to a change in my username.
- Anonymous3 years agoNot applicable
4 years later and your post still helps people out 🙂 Thank you for your solution OwenAuger!
I would be interested if you have an idea how to analyse the use case even further: I have applied the approach of yours adding a category within the small multiple feature. The use case would be to move the date from 1 category and to "reschedule" it to a different category, to see the overall impact on the main KPIs like sum of profit of certain time period.
Do you think this is possible in any way?