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! Learn more

Reply
Anonymous
Not applicable

Max calculation using date slicer

I have a calculation that looks for the last date we have in the data and return the value for that date:

 

Column =
VAR LASTIME = MAX(Query1[ReportDate])
RETURN CALCULATE(VALUES(Query1[OpenInventory]), (Query1[ReportDate]=LASTIME) )
 
I also have a date slicer on ReportDate but once I change the date range to anything before the max date in the data I get a blank for the calculation. I would like the calculation to pick up the max date on my slicer that I select. 4-9-2020 1-16-17 PM.jpg4-9-2020 1-16-36 PM.jpg
4 REPLIES 4
dax
Community Support
Community Support

Hi  @Anonymous , 

You could refer to my sample for details.

Best Regards,
Zoe Zhi

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@Anonymous ,

Have selected Report Date in the slicer. Max should from the date selected in the slicer.

try like

Column =
VAR LASTIME = MAXX(Query1,Query1[ReportDate])
RETURN CALCULATE(VALUES(Query1[OpenInventory]), filter(all(Query1),Query1[ReportDate]=LASTIME) )

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Thanks @amitchandak I tried the following but still receiving a blank once I change the slicer:

 

Column =
VAR LASTIME = MAXX(Query1,Query1[ReportDate])
RETURN CALCULATE(VALUES(Query1[OpenInventory]), filter(all(Query1[ReportDate]),Query1[ReportDate]=LASTIME) )


@Anonymous ,Can you share sample data and sample output.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

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