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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
miguelsus2000
Helper III
Helper III

Lookupvalue

Hi,

I created a "MaximumValue" column on my first able which pulls the highest "Value" from the second table for a specific Product. However, i also want to add a column to my first table called "NameOfHighestValue" as a DAX function. I used the LookupValue function, but i keep getting an error and wont work. Any help is appreciated.
NameOfHighestValue= lookupvalue(secondtable[name], secondtable[value], max(secontable[value]))

Any guidance will be great. Thank you.

 

 

Lefttable.pngrighttable.png

2 REPLIES 2
AllisonKennedy
Community Champion
Community Champion

How are tables 1 and 2 related? Is it a 1 to many?

You could try using the MAXX function:

MAXX(FILTER(Table2, Table2[Product] = Table1[Product] && Table2[Value]=Table1[MaximumValue]), Table2[Name])

If that doesn't work, please provide sample data we can copy easily and screenshot of relationship and error you're getting.

Cheers!

Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

Fowmy
Super User
Super User

@miguelsus2000 

Here is the formula to add as a column to firsttable to fetch the name:

NameOfHighestValue =
VAR T1 = 
    FILTER(
        secondtable,
        secondtable[Product]  = firsttable[Product]
    )
VAR __MaxValue =  MAXX(secondtable[Value],T1)
VAR __Name = 
    MAXX(
        secondtable[Name], 
        FILTER(
            secondtable,
            secondtable[Product]  = firsttable[Product] && secondtable[Value] = __MaxValue 
        )
    )
RETURN

__Name

 

________________________

If my answer was helpful, please consider Accept it as the solution to help the other members find it

Click on the Thumbs-Up icon if you like this reply 🙂

YouTube  LinkedIn

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

July Power BI Update Carousel

Power BI Monthly Update - July 2026

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

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors