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!View all the Fabric Data Days sessions on demand. View schedule
Hi,
Can someone take a look why my Last week sales amount DAX doesn't work? Here is the file
What i did first is to create a Weeknum based on raw data
Then I create a Last week DAX within same table
I correct datatype and logic. Please find file : https://www.dropbox.com/s/usfbwl5d65nmer3/LW%20error.pbix?dl=0
only Last week =
VAR _week = maxx((data),data[Weeknum])-1
Return
CALCULATE(SUM(data[Amount])
,filter(ALL(data),
data[Weeknum]= _week
))
Last week =
VAR week = SELECTEDVALUE(data[Weeknum])
Return
CALCULATE(SUM(data[Amount])
,filter(ALL(data),
data[Weeknum]= max(data[Weeknum]) -1
))
Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks. My Recent Blog -
Winner-Topper-on-Map-How-to-Color-States-on-a-Map-with-Winners , HR-Analytics-Active-Employee-Hire-and-Termination-trend
Power-BI-Working-with-Non-Standard-Time-Periods And Comparing-Data-Across-Date-Ranges
Connect on Linkedin
Thank you @amitchandak It works in imported data.
However it is not working when I connected to data source in SAP HANA using direct query.
Is there any way to show last week amount in direct query?
My data is too huge to export..
Hi @amitchandak,
Also, when I use your file and pull in (opportunity) number field. Current DAX doesn't work anymore ( shows blank).
Can you please advice? Thanks a lot!!
The Weeknum column has the wrong datatype.
It is created from a text value and then gets used as if it is a whole number.
Change it to a number.
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!