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
I have a measure which I want to return the amount we have available in stock of a product.
Since we have a history per product per day, I'd want it to return the amount for the last day or whichever period we're dealing with (for example, 31/12/2020 if I have filtered on the year 2020, or today if I have no filter on the date, etc), but so far, it only works if I filter the date.
The measure goes :
Latest Amount := CALCULATE (
[_Quantity_Sum];
FILTER (
Fact_Stock;
Fact_Stock[Date of Stock]
= MAX ( 'Calendar'[Day in year] )
)
)
And like I said, it gives no result if I only select the product column and this measure, but it will give me a result if I filter on the month or on the day. Any idea on how to make it work with no filter ?
Kindly,
Nossair
@Anonymous , That need a row context to get it. Try this , but it will only give data for max date selected
Latest Amount :=
var _max = maxx(allselected('Calendar'),'Calendar'[Day in year])
return
CALCULATE (
[_Quantity_Sum];
FILTER (
Fact_Stock;
Fact_Stock[Date of Stock]
= _max
)
)
Hi @amitchandak ,
Thanks for your answer, however, indeed, it still doesn't give a result for when I don't filter on the date. Do you have an idea on why that's the case ? I'm still rather new to DAX and I can't quite put my finger on it.
Kindly,
Nossair
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!