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
Anonymous
Not applicable

Getting the latest status from another table based on ID Ref

Hi All ,

 

I am trying to create a custom column to get the latest value from a related table based the latest modified time and date. I have written this formula but an error resulted due to multiple values being returned. 

 
Lastest Status = LOOKUPVALUE(Table_A[Status],Table_A[ID_Ref],Table_B[ID]) 

 

How should i write the DAX to return only the latest status? Appreciate your help ! 

 

Many Thanks

10 REPLIES 10
Anonymous
Not applicable

@Anonymous 

What I understand based on your explanation is that you are trying to add a calculated column on the one side of a many to one relation where TableB is on one side and Table A is on many side.

 

This is the reason why you are getting multiple values.

 

In this case you should try creating a calculated column as below on the Table B which is on one(1) side of (1..*) relation.

 

Latest Status =
 MAXX ( RELATEDTABLE(TableA) , TableA[Status])

You may need to alter this expression depending on your model as you say that is based on latest date and time.
 
Hope you find this hhelpful.
 
Thanks.
Anonymous
Not applicable

Hi @Anonymous 

 

Thank you for your response. I tried your suggestion but the result is not returning correctly though. I guess maxx with related table will return the largest value relevant to the associated ID but somehow it may not work for my context. Anyway, many thanks for your help!  

Anonymous
Not applicable

Hi @harshnathani ,

 

Somehow it work for all my sample records (total around 13) except for 1. Not sure what went wrong with but i will recheck my datasource.

 

Thanks !  

Hi @Anonymous ,

 

Try cleaning and trimming the  Column in Power Query.

 

1.jpg

 

Table A

 

 

2.JPG

 

Table B

 

 

 

 

Regards,
Harsh Nathani

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

Anonymous
Not applicable

@harshnathani 

 

Thanks. Let me go try out !

harshnathani
Community Champion
Community Champion

Hi @Anonymous ,

 

Try using 

 

Operator=
CALCULATE (
    FIRSTNONBLANK ( Table_A[Status], 1 ),
    FILTER ( ALL ( Table_A ), Table_A[ID] = Table_B[ID] )
)

 

@Anonymous , Try as new colum 

maxx(filter(Table, Table_A[ID_Ref]=Table_B[ID]),Table_A[Status])

or

maxx(filter(Table, Table_A[ID_Ref]=Table_B[ID]),lastnonblankvalue(Table_A[Date],max(Table_A[Status])))

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
Anonymous
Not applicable

Hi @amitchandak 

 

Many thanks for your swift response and help ! 

 

I tried out your suggestion and the end result is equiavlent to what @Anonymous  proposed. But somehow the return value is not the latest value that it should return.  

 

 

@Anonymous ,Can you share sample data and sample output in table format?

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

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.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.