Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

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:

YearQuarterMonthDayWEEKFCSTPREV. WK FCSTFCST DIFF vs PREV. WK
2020Qtr 1January62020021,861,9801,864,549-2,569
2019Qtr 4December302020011,864,5491,904,024-39,475
2019Qtr 4December232019521,904,0241,895,5398,485
2019Qtr 4December162019511,895,5391,868,80226,737
2019Qtr 4December92019501,868,8021,855,45713,345
2019Qtr 4December22019491,855,457  

 

FCST = SUM(FCST[FCST QTY])

PREV. WK FCST = CALCULATE([FCST],DATEADD('CALENDAR'[Date],-7,DAY))

FCST DIFF vs PREV. WK = [FCST]-[PREV. WK FCST]
 
So, for example, if I pick week 49 and week 52 it should give me the following:
YearQuarterMonthDayWEEKFCSTPREV. WK FCSTFCST DIFF vs PREV. WK
2019Qtr 4December232019521,904,0241,855,45748,567
2019Qtr 4December22019491,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 4
v-yuta-msft
Community Support
Community 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.

 

Anonymous
Not 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,

@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.

Anonymous
Not applicable

@v-yuta-msft , unfortunately it's not working. 

So, the measure is working but it's not doing what it's supposed to. 

 

Slicer is based on a column in my CALENDAR table which is, of course, connected to my fact table.

 

First 3 colums are my current measures, last one the one using your solution 

 
PREV. WK FCST =
CALCULATE ( [FCST], FILTER ( ALLSELECTED ( 'CALENDAR' ), DATEADD('CALENDAR'[Date], -7,DAY) ))
 
SPI WEEKFCSTPREV. WK FCSTPREV. WK FCST V2
2020031,868,5861,861,9805,628,067
2019521,904,0241,895,5395,628,067
2019491,855,4571,836,3935,628,067

 

So, I selected 3 different WKS as you can see in table above where the first 3 columns are my current measures and the last one the one you have proposed. What it's actually doing is a SUM of all the selected weeks FCST .

 

Instead, I would like it to show as follows:

SPI WEEKFCSTPREV. WK FCSTPREV. WK FCST V2
2020031,868,5861,861,9801,904,024
2019521,904,0241,895,5391,855,457
2019491,855,4571,836,393BLANK

 

Does it makes sense?

 

Thanks a lot for your time buddy.

 

Regards,

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors