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

Prepping for a Fabric certification exam? Join us for a live prep session with exam experts to learn how to pass the exam. Register now.

Reply
Anonymous
Not applicable

DAX LOOKUPVALUE with MAX

Hi,

 

Im trying to lookup a value from another table with MAX

I have two data tables like this:

 

Table1:

Udklip.PNG

Table2:

Udklip3.PNG

What I'd like to do is, for the empty values in "Table2[Latest Result]" to find the value in "Table1[Result]" based on the highest number in "Table1[Unix]", so i get the latest update from each ID.

 

So that Table2 ends as:

 

Udklip2.PNG
 
I have tried:
 
Latest Result = LOOKUPVALUE ( 'Table1'[Result] ; 'Table2'[ID] ; MAX ( 'Table1'[Time] ) )

 

But gives me all blank, not sure how to fix this.

 

Anyone that got an idea?

2 ACCEPTED SOLUTIONS
AlB
Community Champion
Community Champion

Hi @Anonymous 

Try this for your calculated column in Table2:

 

LatestResult =
VAR Latest_Time_ =
    CALCULATE (
        MAX ( Table1[Time] ),
        FILTER ( ALL ( Table1[ID] ), Table1[ID] = Table2[ID] )
    )
RETURN
    LOOKUPVALUE (
        Table1[Result],
        Table1[ID], Table2[ID],
        Table1[Time], Latest_Time_
    )

 

View solution in original post

v-yuta-msft
Community Support
Community Support

@Anonymous ,

 

You can also create a calculate column in table2 using DAX below:

Latest Result = 
VAR Current_ID = Table2[ID]
VAR Max_Unix_Per_ID = CALCULATE(MAX(Table1[Unix]), FILTER(Table1, Table1[ID] = Current_ID))
RETURN
CALCULATE(MAX(Table1[Result]), FILTER(Table1, Table1[Unix] = Max_Unix_Per_ID))

Capture.PNG 

 

Community Support Team _ Jimmy Tao

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-yuta-msft
Community Support
Community Support

@Anonymous ,

 

You can also create a calculate column in table2 using DAX below:

Latest Result = 
VAR Current_ID = Table2[ID]
VAR Max_Unix_Per_ID = CALCULATE(MAX(Table1[Unix]), FILTER(Table1, Table1[ID] = Current_ID))
RETURN
CALCULATE(MAX(Table1[Result]), FILTER(Table1, Table1[Unix] = Max_Unix_Per_ID))

Capture.PNG 

 

Community Support Team _ Jimmy Tao

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

AlB
Community Champion
Community Champion

Hi @Anonymous 

Try this for your calculated column in Table2:

 

LatestResult =
VAR Latest_Time_ =
    CALCULATE (
        MAX ( Table1[Time] ),
        FILTER ( ALL ( Table1[ID] ), Table1[ID] = Table2[ID] )
    )
RETURN
    LOOKUPVALUE (
        Table1[Result],
        Table1[ID], Table2[ID],
        Table1[Time], Latest_Time_
    )

 

Helpful resources

Announcements
PBIApril_Carousel

Power BI Monthly Update - April 2025

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

Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

April2025 Carousel

Fabric Community Update - April 2025

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