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
admin11
Memorable Member
Memorable Member

How to use Lookup command to brand pro_class_desc from sales table to inventory table ?

Hi All

 

I have post below post 1 week ago :-

https://community.powerbi.com/t5/Desktop/How-to-bring-pro-class-desc-field-from-sales-table-to-inven...

 

I got below expression :-

Column =
LOOKUPVALUE(
'SALES'[pro_class_desc],
'SALES'[stock_code], 'INVC'[stock_code],
'SALES'[pro_class], 'INVC'[pro_class]
)
 
i get the error :-
Function 'LOOKUPVALUE' does not support comparing values of type Text with values of type Integer. Consider using the VALUE or FORMAT function to convert one of the values.
admin11_0-1614294826355.png

 

My PBI file :-
 
Paul
1 ACCEPTED SOLUTION
HotChilli
Super User
Super User

First attempt to fix the code- Change the datatype of INVC[stock code] to text. Gets rid of the error.  Doesn't bring back many matches though.

 

Second attempt - Change code to 

Column2 =
LOOKUPVALUE(
'SALES'[pro_class_desc],
'SALES'[pro_class], 'INVC'[pro_class]
)
because it doesn't look like the stock code match is required.  More matches but still not great.
 
Third attempt - doesn't 'Drawwing Number' field in INVC have the data anyway?  It's a badly named field.
 
--------------------------
Anyway, you know your data best so I'll let you investigate.

View solution in original post

4 REPLIES 4
HotChilli
Super User
Super User

It just means that more than 1 'SALES'[pro_class_desc] are being returned for the same search fields.  Either the data is wrong - totally different pro_class_desc or slightly different spelling or something -  or you're going to have to take a decision about which pro_class_desc is correct 

@HotChilli 

I think I have to use another approach 

thank you for sharing 

paul

HotChilli
Super User
Super User

First attempt to fix the code- Change the datatype of INVC[stock code] to text. Gets rid of the error.  Doesn't bring back many matches though.

 

Second attempt - Change code to 

Column2 =
LOOKUPVALUE(
'SALES'[pro_class_desc],
'SALES'[pro_class], 'INVC'[pro_class]
)
because it doesn't look like the stock code match is required.  More matches but still not great.
 
Third attempt - doesn't 'Drawwing Number' field in INVC have the data anyway?  It's a badly named field.
 
--------------------------
Anyway, you know your data best so I'll let you investigate.

@HotChilli 

 

When i load only one company data , your expression working fine :-

 

When i try to put your expression into my actual PBI file , i get error :-

 

Link By pro_class :-

admin11_1-1614321238292.png

 

Link using Stock Code :-

admin11_0-1614321199918.png

 

Any suggestion ?

 

Paul

 

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.