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

MAX of dates

Hello,

 

I want to get the max of the two selected dates and flag it as 1 if it is equal to the MAX of the selected date.

Selected dates from the slicer:

Ishan25_0-1595843655202.png

Table:

Ishan25_1-1595843886981.png

Here in the table of the selected dates i want to flag the smaller date as 0 and latest selected date as 1.

 

Can you please help

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , try like
measure =
var _max = maxx(allselected(Date),Date[date])
return
if(max(Table[asofdate]) = _max ,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

View solution in original post

6 REPLIES 6
Fowmy
Super User
Super User

@Anonymous 

Is Cross Filtering form (Format Tab> Interaction) enabled between these two visuals? 




Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

amitchandak
Super User
Super User

@Anonymous , try like
measure =
var _max = maxx(allselected(Date),Date[date])
return
if(max(Table[asofdate]) = _max ,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
Anonymous
Not applicable

Hi,

 

When i select other dates like as shown in screenshot it does not work:

Ishan25_0-1595847157764.png

Here the previous date should show flag as  0 but it is showing as 1:

Ishan25_1-1595847258894.png

 

 

Anonymous
Not applicable

Hi @amitchandak 

 

I am facing one problem with the solution.

I have selected two dates in my slicer but when i filter the records (example filter applied on a item location code ) present only in the past date using the filter pane the measure returns 1 eventhough i have selected two dates in myslicer.

I get how the measure is working on the basis of data present in the filter and as the visual has only one date it will show as 1.

I want the measure values to be based on the selection in slicer only and not on the visual data.

 

Can you please help me with that as wothout this my another measure(which uses the date measure too) changes it's value as the user filters further more

@Anonymous , check i tried the same

Screenshot 2020-07-27 16.53.31.png

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

Hi @amitchandak 

 

Thank you for the solution it worked as expected.

 

Previously i selected only  one filter from the report level filter and that is why i was confused.

 

But now i understood. Thank you for the help.🙂

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.