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
Theresaz
New Member

Checking if the date & time is the latest while filtering by column

I have the following scenario: a table of product data that has a "updated time" column. The most useful info for current status reports is obviously the latest, so I'm thinking of including the calculated column "is latest" as shown below

Product IDQtyUpdated timeIs latest
00151/12/2023 10:00 AM1
00241/12/2023 11:00 AM1
00121/12/2023 9:00 AM0

 

The problem is, when I attempt to calculate the Is latest value with a simple IF(Updated time = MAX(Updated time),1,0) it will compare the Updated time from Product 001 with the Updated time from Product 002, so it will only mark with a "1" the most recently updated product.
Is there a way to include a filter by Product ID in the formula? I've tried a couple of things but I can't find a way to filter the calculation by the ID without specifying an ID in particular.
Any help would be appreciated!

1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

Hi @Theresaz 
Please try

Is Latest =
IF (
    'Table'[Updated time]
        = CALCULATE (
            MAX ( 'Table'[Updated time] ),
            ALLEXCEPT (
                'Table',
                'Table'[Product ID]
            )
        ),
    1
)

View solution in original post

2 REPLIES 2
tamerj1
Super User
Super User

Hi @Theresaz 
Please try

Is Latest =
IF (
    'Table'[Updated time]
        = CALCULATE (
            MAX ( 'Table'[Updated time] ),
            ALLEXCEPT (
                'Table',
                'Table'[Product ID]
            )
        ),
    1
)
sebouier
Frequent Visitor

To get the "Updated time maximum" by "Product", try this DAX formula: 

 

 

IF([Updated time] = CALCULATE(MAX([Updated time]), ALLEXCEPT('Your table',[Product]),1,0)

 

 

 

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.