Forum Discussion
Show variance based on filter selection
Hello experts!
I have created some measures to display the variance between a week and the previous one to that however I would like to be able to have the variance showing accordingly to a slicer selection. If nothing is selected then show the difference with previous week as I already have it:
| Year | Quarter | Month | Day | WEEK | FCST | PREV. WK FCST | FCST DIFF vs PREV. WK |
| 2020 | Qtr 1 | January | 6 | 202002 | 1,861,980 | 1,864,549 | -2,569 |
| 2019 | Qtr 4 | December | 30 | 202001 | 1,864,549 | 1,904,024 | -39,475 |
| 2019 | Qtr 4 | December | 23 | 201952 | 1,904,024 | 1,895,539 | 8,485 |
| 2019 | Qtr 4 | December | 16 | 201951 | 1,895,539 | 1,868,802 | 26,737 |
| 2019 | Qtr 4 | December | 9 | 201950 | 1,868,802 | 1,855,457 | 13,345 |
| 2019 | Qtr 4 | December | 2 | 201949 | 1,855,457 |
FCST = SUM(FCST[FCST QTY])
PREV. WK FCST = CALCULATE([FCST],DATEADD('CALENDAR'[Date],-7,DAY))
| Year | Quarter | Month | Day | WEEK | FCST | PREV. WK FCST | FCST DIFF vs PREV. WK |
| 2019 | Qtr 4 | December | 23 | 201952 | 1,904,024 | 1,855,457 | 48,567 |
| 2019 | Qtr 4 | December | 2 | 201949 | 1,855,457 |
I hope my explanation is clear enough otherwise please, let me know and I will do my best to help you so you can help me 🙂
Regards,
Anonymous hello Cheenu, I have seen some posts with similar issues so I thought I might contact you directly with mine and see whether you can help me 🙂
Thanks!!
4 Replies
- v-yuta-msftCommunity Support
Anonymous ,
Modify the measure using dax below:
PREV. WK FCST = CALCULATE ( [FCST], FILTER ( ALLSELECTED ( Table ), DATEADD ( 'CALENDAR'[Date], -7, DAY ) ) )Community Support Team _ Jimmy Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- AnonymousNot applicable
Hello v-yuta-msft
For some reason it doesn't work. I am not sure whether I am doing it properly or not but just to be sure, to which 'table' should I refer the ALLSELECTED function? I tried with my calendar table and didn't work.
Thanks in advance!
Regards,
- v-yuta-msftCommunity Support
Anonymous ,
This based on your slicer. If you build slicer based on date column in the fact table, then the expression should be ALLSELECTED(Fact_Table).
Community Support Team _ Jimmy Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.