Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hi,
I am attempting to create a measure that will show the quantity for the last fiscal week to then us to create % var. I have working statment but it isn't taken into account where the fiscalweek of the year = 1 and then needs to refer to the max fiscal week of the previous year (52/53). Can anyone see where i am going wrong on the below. The issue is formula for retrieving VAR MXWeekLY. Thanks!
Week LW Quantity:=
VAR CurrentYear = SELECTEDVALUE(Dates[FiscalYear])
VAR CurrentWeek = SELECTEDVALUE(Dates[FiscalWeekOfYear])
VAR MXWeekLY =MAX(Dates[FiscalWeekOfYear],FILTER(ALL(Dates),Dates[FiscalYear]=CurrentYear-1))
RETURN CALCULATE([Quantity],FILTER(ALL(Dates),Dates[FiscalYear]=IF(CurrentWeek=1, CurrentYear-1,CurrentYear) && Dates[FiscalWeekOfYear]=IF(CurrentWeek=1,MXWeekLY,CurrentWeek-1)
))
Table containing Quantity
| DateKey | Quantity | Total Sales |
| 01/01/2020 | 10 | 30 |
| 02/01/2020 | 11 | 33 |
| 03/01/2020 | 12 | 36 |
| 04/01/2020 | 11 | 33 |
| 05/01/2020 | 13 | 39 |
Date Dim Table (Joined on Date)
| DateKey | FiscalYear | FiscalMonth | FiscalDayofYear |
| 01/01/2020 | 2019 | 12 | 361 |
| 02/01/2020 | 2019 | 12 | 362 |
| 03/01/2020 | 2019 | 12 | 363 |
| 04/01/2020 | 2019 | 12 | 364 |
| 05/01/2020 | 2020 | 1 | 1 |
Would be very helpful if there was sample data. Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490
See if my Time Intelligence the Hard Way provides a different way of accomplishing what you are going for.
https://community.powerbi.com/t5/Quick-Measures-Gallery/Time-Intelligence-quot-The-Hard-Way-quot-TIT...
Thanks for the heads up Greg, I have attached the sample data. Your hard way guide is good, however I wish to use selectedvalues and not create rolling totals.
Dave
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 12 | |
| 9 | |
| 9 | |
| 5 | |
| 4 |
| User | Count |
|---|---|
| 27 | |
| 22 | |
| 20 | |
| 18 | |
| 12 |