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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
jtooke
Helper I
Helper I

Calculate the most recent date by ID

Hello everyone,

 

I am trying to return a column with the most recent date by ID for a given set of data. Below is a sample set of data. In my table I have three columns Name, Name ID, and Date. The fourth column would be a calculated column, and return the most recent date by the unique NameID column. Is there a way that I can do this? Thank you!

 

NameNameIDDateCALCULATED - Most Recent by Name ID
Mark13/15/20194/7/2020
John26/3/20206/3/2020
Tom38/7/202011/1/2020
Tom38/7/202011/1/2020
Tom38/7/202011/1/2020
Sarah42/1/20182/1/2018
Kim57/6/20177/6/2017
Mark14/7/20204/7/2020
Tom311/1/202011/1/2020
Steve63/2/20193/2/2019

 

1 ACCEPTED SOLUTION
ChrisMendoza
Resident Rockstar
Resident Rockstar

@jtooke - Does this meet your requirement?

HASONEVALUE hides the 'Total' row for the measure.

Measure = 
IF(
    HASONEVALUE('Table'[NameID]),
    CALCULATE(
        MAX('Table'[Date]),
        ALLEXCEPT('Table','Table'[NameID])
    ),
    BLANK()
)

image.png






Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

Proud to be a Super User!



View solution in original post

5 REPLIES 5
ChrisMendoza
Resident Rockstar
Resident Rockstar

@jtooke - Does this meet your requirement?

HASONEVALUE hides the 'Total' row for the measure.

Measure = 
IF(
    HASONEVALUE('Table'[NameID]),
    CALCULATE(
        MAX('Table'[Date]),
        ALLEXCEPT('Table','Table'[NameID])
    ),
    BLANK()
)

image.png






Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

Proud to be a Super User!



Thank you for the response @ChrisMendoza . When I try this measure all that returns is blanks?

Try below first then and see if you like the output.

    CALCULATE(
        MAX('Table'[Date]),
        ALLEXCEPT('Table','Table'[NameID])
    )





Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

Proud to be a Super User!



Hm, that doesn't quite work either. With that formula the column just shows the same date as in the initial column.

Review the attached






Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

Proud to be a Super User!



Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.