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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
v-power
Frequent Visitor

Identifying the "Last updated" column based on two dates

Hello All, 

 

I would like to create a column with flag 1 or 0 based on two date columns. Here is the sample data:

 

KPI NameMonthModified
KPI11/3/20192/6/2019
KPI12/5/20192/5/2019
kpi12/5/20192/6/2019

 

I want to take the max of month first. So in this case, it will be 2/5/2019 with two modified dates, then I have to take the max of modified date. So final output should be something like this:

 

KPI NameMonthModifiedIs Latest
KPI11/3/20192/6/20190
KPI12/5/20192/5/20190
kpi12/5/20192/6/20191

 

Only the last row should be returned. 

 

I tried a couple of dax queries and it doesnt yield the result I want. Can someone help ?

1 ACCEPTED SOLUTION
Zubair_Muhammad
Community Champion
Community Champion

@v-power 

 

Try this as calculated column

 

IsLatest =
IF (
    AND (
        [Month] = MAX ( [Month] ),
        [Modified]
            = CALCULATE ( MAX ( [Modified] ), FILTER ( Table1, [Month] = MAX ( [Month] ) ) )
    ),
    1,
    0
)

Regards
Zubair

Please try my custom visuals

View solution in original post

1 REPLY 1
Zubair_Muhammad
Community Champion
Community Champion

@v-power 

 

Try this as calculated column

 

IsLatest =
IF (
    AND (
        [Month] = MAX ( [Month] ),
        [Modified]
            = CALCULATE ( MAX ( [Modified] ), FILTER ( Table1, [Month] = MAX ( [Month] ) ) )
    ),
    1,
    0
)

Regards
Zubair

Please try my custom visuals

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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