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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
ggzmorsh
Helper II
Helper II

Calculate MAX text value

I have Table1 which contains 4 occurrences of the same ID happening in different date/times and remarks.

What i need to do is to return the most recent remarks which is "A". I tried using max value however it is only returning me the sorted alphabet which is "D" and i also used lookup value to return the last remark from the max date however remark "B" and "C" was updated at the same time.

 

 

 

IDDateRemarks
ABC12301/06/2021 12:31:18B
ABC12301/07/2021 12:31:18C
ABC12301/08/2021 12:31:19D
ABC12301/09/2021 12:31:20E
ABC12301/10/2021 12:31:18A
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @ggzmorsh ,

You can create a measure as below:

 

Latest remark = 
VAR _maxdate =
    CALCULATE ( MAX ( 'Table'[Date] ), ALLEXCEPT ( 'Table', 'Table'[ID] ) )
RETURN
    CALCULATE (
        MAX ( 'Table'[Remarks] ),
        FILTER (
            'Table',
            'Table'[ID] = MAX ( 'Table'[ID] )
                && 'Table'[Date] = _maxdate
        )
    )

 

Calculate MAX text value.JPG

Best Regards

View solution in original post

7 REPLIES 7
Anonymous
Not applicable

Hi @ggzmorsh ,

You can create a measure as below:

 

Latest remark = 
VAR _maxdate =
    CALCULATE ( MAX ( 'Table'[Date] ), ALLEXCEPT ( 'Table', 'Table'[ID] ) )
RETURN
    CALCULATE (
        MAX ( 'Table'[Remarks] ),
        FILTER (
            'Table',
            'Table'[ID] = MAX ( 'Table'[ID] )
                && 'Table'[Date] = _maxdate
        )
    )

 

Calculate MAX text value.JPG

Best Regards

This is the closest solution from what i have. However since we using the MAX in the dax that means if there is two dates with the same value it will return the sorted remarks from Z-A. This brings light! thank you.

amitchandak
Super User
Super User

@ggzmorsh , Try measure like

lastnonblankvalue(Table[Date],Max(Table[Remark]))

 

or


calculate(lastnonblankvalue(Table[Date],Max(Table[Remark])), allexpect(Table, Table[ID]))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

My dear, I have used the formula 

Last Remark = LASTNONBLANKVALUE(Table1[Date],MAX(Table1[Remark]))
which worked on a smaller scale however when used with a table which contains more than 15 million rows it is returning me wrong data.
 

I have tried your solution and it worked at the topic at hand. I will mark it as an accepted solution once i test it to a larger data and verify the results.

Gabriel_Walkman
Continued Contributor
Continued Contributor

How about like this? Pull in a visual filter for Date and use Top 1.

 

date-top1.png

 

 

I needed it as a dax column.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors