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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Anonymous
Not applicable

vlookup value not working

i have two table  table1 and table2  both  table common value product code i trying to vlookup the value not working 

 

Table 1 

 

Product        M1        M3      Actuals 

 FA0001        52         45         435

 FA0003        52         45         435

 FA0004        52         45         435

 FA0005        52         45         435

 FA0006        52         45         435

 FA0007        52         45         435

 

Table 2 :

 

Product     SPVCode        SPVDesc   Product Category 

 

 FA00045        10052                45           435

 FA0003          20052                45          435

 FA0004          30052                45          435

 FA00015         40052               45            435

 FA0006          50052                45            435

 

my outout want look like 

 

Table 1 

 

Product        M1        M3      Actuals  SPVCode        SPVDesc   Product Category 

 FA0001        52         45         435

 FA0003        52         45         435       20052                45              435

 FA0004        52         45         435       30052                45               435   

 FA0005        52         45         435 

 FA0006        52         45         435        50052              45                435

 FA0007        52         45         435

 

i am have tired with lookup value function i am getting Error 

 

SPDCODE = LOOKUPVALUE('table2'[Product],'table2'[SPVCODE ],MAX('Table1'[Product]))
 
Function 'LOOKUPVALUE' does not support comparing values of type Integer with values of type Text. Consider using the VALUE or FORMAT function to convert one of the values.
6 REPLIES 6
Jos_Woolley
Solution Sage
Solution Sage

Hi,

Not quite sure why MAX and MAXX are being used here. Aren't you simply wishing to perform a straight lookup?

 

SPVCODE = LOOKUPVALUE('Table2'[SPVCode],'Table2'[Product],[Product])

 

If you create a relationship between the two tables based on the Product column, you could use simply:

 

SPVCODE =
RELATED ( Table2[SPVCode] )

 

Regards

@Jos_Woolley I was assuming with the MAX that this was a measure but if it is a column you are correct. Using the MAXX(FILTER(...)...) form instead of LOOKUPVALUE solves the instance where multiple rows are returned with the same value. In this case, LOOKUPVALE will fail while MAXX will succeed.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Ah, thanks, good point. It didn't even cross my mind that the OP might be wanting a measure here, not a calculated column.

 

Regards

Greg_Deckler
Community Champion
Community Champion

@Anonymous You have your result and search columns reversed:

SPDCODE = LOOKUPVALUE('table2'[SPVCODE ],'table2'[Product],MAX('Table1'[Product]))


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

@Greg_Deckler  i am getting error like below 

 

Function 'LOOKUPVALUE' does not support comparing values of type Integer with values of type Text. Consider using the VALUE or FORMAT function to convert one of the values.

@Anonymous LOOKUPVALUE has the form of:

LOOKUPVALUE(<result column>, <search column>, <search value)

Seems like your Product columns are both text, not sure how they could be numeric so they should be the second and third parameters. Your SPVCODE column looks like it is numeric. Having it be the result column should not produce that error since it is not being compared. 

 

You can try an alternative method:

SPDCODE = MAXX(FILTER('table2','table2'[Product] = MAX('Table 1'[Product])),[SPVCODE])


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
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.

June 2025 community update carousel

Fabric Community Update - June 2025

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