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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

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
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 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.