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
nirvana_moksh
Impactful Individual
Impactful Individual

DAX formula for latest text value

Hello All,

 

I had a previously working DAX formula which worked fine after a lot of testing too, but I am questioning its validity now. I have a table like below. Where the ID column can repeat multiple times, but in my data table visual I want to show ID, and the most recent inserted description and then the date for that description. My DAX was CALCULATE (LASTNONBLANK('TABLE A'[DESCRIPTION],1,FILTER('TABLE A','TABLE A'[INDEX] = MAX('TABLE A'[INDEX]) 

 

 

The index column is the index column I inserted in Power Query.

 

IDDESCRIPTIONINSERT DATE
1TOP 16/5/18 12:00 PM
1TOP 26/5/18 1:00 PM
1TOP 36/5/18 3:00 PM
2TEST 16/7/18 12:00 AM
3TEXT 16/8/18 12:00 AM
4HELLO 16/9/18 12:00 AM

 

I want to use a measure and not adopt the previously used techniques of selected 'Latest Insert Date' because that was messing things up for some reason.

 

Thank You

1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

 

These are the DAX formulas i used

 

Most recent date = MAX(Data[INSERT DATE])

Most recent description = LOOKUPVALUE(Data[DESCRIPTION],Data[INSERT DATE],[Most recent date],Data[ID],MAX(Data[ID]))

 

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

5 REPLIES 5
Ashish_Mathur
Super User
Super User

Hi,

 

These are the DAX formulas i used

 

Most recent date = MAX(Data[INSERT DATE])

Most recent description = LOOKUPVALUE(Data[DESCRIPTION],Data[INSERT DATE],[Most recent date],Data[ID],MAX(Data[ID]))

 

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

I just tried yours and it works perfectly! Just one question, for the part '[Most recent date]' in your DAX formula I substiuted that with MAX(Insert Date) and that worked, but will this work per ID? Meaning will it look at the MAX of Insert Date per ID even if they are more than 1 or will it see MAX of Insert Date for the entire data table of ID's?

Yes, it will work per ID.  If my reply helped, please mark it as Answer.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Thanks a lot Ashish, upon doubling checking my DAX formula I found out the reason for my suspicion was because the relationship between the two tables was broken which is why my results on the visulations were so weird. Out of curiosty, did you have a chance to give my DAX formula a look? Just wanted a confirmation if that is still good.

I did not try your DAX formula.  Did you try mine?  Is it working fine?


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

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.