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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Conance-steven
Frequent Visitor

DAX statement to show only most recent text value

I have a simple table with progress statusses, per project, linked to a calendar date. I'm looking for a DAX statement which shows only the most recent (latest available date) status per project. That should be the statusses for February; Amber, Green, Amber.

Capture2.JPG

 

My current DAX statement is:

Latest status  with hasonevalue = IF (
    HASONEVALUE ( 'Status'[Project] ),
    LASTNONBLANK ( 'Status'[Status], LASTDATE ( 'Status'[Date] ) ),
    BLANK ()
)

 

The output for this statement is as shown below and not what I was expecting. 

Can someone explain to me why this is the output, and how I can adjust the DAX statement to fix this?

I also tried with FIRSTNONBLANK, different output but also not as expected.

 

Capture.JPG

1 ACCEPTED SOLUTION
harshnathani
Community Champion
Community Champion

Hi @Conance-steven ,

 

Please see if this is the solution you are looking for.

Attached is the sheet.

 

1.JPG2.JPG

 

 

Regards,
Harsh Nathani
Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

View solution in original post

3 REPLIES 3
Conance-steven
Frequent Visitor

Many thanks to both. I'm going for the shorter code solution 🙂 

AntrikshSharma
Super User
Super User

@Conance-steven  Here is another way to calculate status:

1.png

 

Latest Status = 
VAR CurrentVisibleProject =
    SELECTEDVALUE ( Steven[Project] )
VAR MostRecentDate =
    CALCULATE (
        MAX ( Steven[Date] ),
        TREATAS ( { CurrentVisibleProject }, Steven[Project] )
    )
VAR Result =
    CALCULATE (
        CONCATENATEX ( VALUES ( Steven[Status] ), Steven[Status], ", " ),
        TREATAS ( { CurrentVisibleProject }, Steven[Project] ),
        TREATAS ( { MostRecentDate }, Steven[Date] )
    )
RETURN
    Result
harshnathani
Community Champion
Community Champion

Hi @Conance-steven ,

 

Please see if this is the solution you are looking for.

Attached is the sheet.

 

1.JPG2.JPG

 

 

Regards,
Harsh Nathani
Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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