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

Win a FREE 3 Day Ticket to FabCon Vienna. Apply now

Reply
dwel0120
Helper III
Helper III

If MAX or LASTDATE then 1

This should be really easy but I'm not getting it to work for reasons I can't figure out. 

 

I have a dataset with different dates (DATE column) and I want to add a new column that puts a 1 on the rows with the max/last date on it otherwise 0. 

1 ACCEPTED SOLUTION

Hi @dwel0120 
Please try this measure:

 

Last Date =
VAR _MaxDate =
    CALCULATE ( MAX ( FB_TOP_CONTRIBUTORS[DATE] ), ALL ( FB_TOP_CONTRIBUTORS ) )
RETURN
    IF ( FB_TOP_CONTRIBUTORS[date] = _Maxdate, 1, 0 )

 

output:

 

VahidDM_1-1630022130416.png

 

 

Did I answer your question? Mark my post as a solution! 

Appreciate your Kudos VahidDM_0-1630021925827.png !!

View solution in original post

4 REPLIES 4
VahidDM
Super User
Super User

Hi @dwel0120 
Please try this measure:

 

Last Date = 
Var _MaxDate = calculate(max(table[DATE],all(table))
return
if(table[date]=_Maxdate,1,0)

 

Did I answer your question? Mark my post as a solution!

Appreciate your Kudos VahidDM_0-1629940983243.png !!

@VahidDM  That didn't work. See error below. 

 

dwel0120_0-1629986211539.png

 

Hi @dwel0120 
Please try this measure:

 

Last Date =
VAR _MaxDate =
    CALCULATE ( MAX ( FB_TOP_CONTRIBUTORS[DATE] ), ALL ( FB_TOP_CONTRIBUTORS ) )
RETURN
    IF ( FB_TOP_CONTRIBUTORS[date] = _Maxdate, 1, 0 )

 

output:

 

VahidDM_1-1630022130416.png

 

 

Did I answer your question? Mark my post as a solution! 

Appreciate your Kudos VahidDM_0-1630021925827.png !!

Thank you. That worked. I didn't see that I needed the ). 

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.