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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Anonymous
Not applicable

need to find details related to latest date in Policy based on date selected in the Slicer.

Hi Guys, I am facing an issue in getting a solution for finding details related to the latest date in policy based on date range selected using the slicer.

 

Date used. - 

Kaushlendra_EY_0-1651237972419.png

I want to get details related to the latest date when the status is "In Progress" for policy x.

 

I have made a measure flag 

Max Flag = IF(MAX(Sheet1[Date]) = CALCULATE(MAX(Sheet1[Date]),ALLEXCEPT(Sheet1,Sheet1[Policy])),1,0)
 
this is working fine when the complete date range is selected in the slicer means till 5 June 2022 but when I reduce the slicer range it is not giving data corresponding to 1 Feb 2021 the table is getting blank. Instead, it is giving values related to both 1 Feb 2021 and 4 May 2020. I want only value corresponding to 1 Feb 2021 when Slicer is moved to left a little.
I want the flag to be dynamic based on slicer range.
 
I am attaching the file PBIX file. 
 
1 ACCEPTED SOLUTION
v-yalanwu-msft
Community Support
Community Support

Hi, @Anonymous ;

Modify it.

Max Flag = IF(MAX(Sheet1[Date]) = CALCULATE(MAX(Sheet1[Date]),FILTER(ALLSELECTED(Sheet1),[Policy]=MAX('Sheet1'[Policy]))),1,0)

The final output is shown below:

vyalanwumsft_0-1651646987793.png


Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-yalanwu-msft
Community Support
Community Support

Hi, @Anonymous ;

Modify it.

Max Flag = IF(MAX(Sheet1[Date]) = CALCULATE(MAX(Sheet1[Date]),FILTER(ALLSELECTED(Sheet1),[Policy]=MAX('Sheet1'[Policy]))),1,0)

The final output is shown below:

vyalanwumsft_0-1651646987793.png


Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Above code is not working.

amitchandak
Super User
Super User

@Anonymous ,

try like

Max Flag = IF(MAX(Sheet1[Date]) = CALCULATE(MAX(Sheet1[Date]),ALLSELECTED(Sheet1[Policy])),1,0)

or

 

Max Flag = IF(MAX(Sheet1[Date]) = CALCULATE(MAX(Sheet1[Date]),ALLSELECTED()),1,0)

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.