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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
dtg87
Frequent Visitor

Retrieve Quantity for Last Fiscal Week (using Dates Table)

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

DateKeyQuantityTotal Sales
01/01/20201030
02/01/20201133
03/01/20201236
04/01/20201133
05/01/20201339

 

 

Date Dim Table (Joined on Date)

DateKeyFiscalYearFiscalMonthFiscalDayofYear
01/01/2020201912361
02/01/2020201912362
03/01/2020201912363
04/01/2020201912364
05/01/2020202011
2 REPLIES 2
Greg_Deckler
Community Champion
Community Champion

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



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

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

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.