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
webstark
Frequent Visitor

Getting latest date from date column where there are multiples of a value in another column

Hi,

 

I have a table with two columns; a SiteID column (number) where there could be mutiple rows for each site ID and a DateAdded field which would have the date the equipment was added to the site.

 

I want to create a another column which compares the dates for mulitple entries of the same SiteID and returns the latest date of how ever many there are

 

SiteID       Date Added                  Last Date

--------|-------------------------|--------------

1         |    1/1/2016 00:00:00

1         |    15/5/2016 00:00:00

1         |      2/11/2016 00:00:00

1         |                                     |  2/11/2016 00:00:00

 

Can this be done?

1 ACCEPTED SOLUTION
Sean
Community Champion
Community Champion

@webstark

It looks like you are asking for a COLUMN formula

Last Date Added COLUMN =
CALCULATE (
    LASTDATE ( TableName[Date Added] ),
    ALLEXCEPT ( TableName, TableName[SiteID] )
)

If you want a MEASURE instead then try this

Last Date Added MEASURE =
CALCULATE ( LASTDATE ( TableName[Date Added] ), VALUES ( TableName[SiteID] ) )

Hope this helps! Smiley Happy

 

View solution in original post

1 REPLY 1
Sean
Community Champion
Community Champion

@webstark

It looks like you are asking for a COLUMN formula

Last Date Added COLUMN =
CALCULATE (
    LASTDATE ( TableName[Date Added] ),
    ALLEXCEPT ( TableName, TableName[SiteID] )
)

If you want a MEASURE instead then try this

Last Date Added MEASURE =
CALCULATE ( LASTDATE ( TableName[Date Added] ), VALUES ( TableName[SiteID] ) )

Hope this helps! Smiley Happy

 

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.