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

Error: LOOK UP VALUE does not support comparing values

Hi all,

 

I found the above error when trying to create a calculated column using the LOOKUPVALUE function.

So I have the following tables;

 

Table A   
IDAMOUNT DecriptionCountry
567933-YYDD1000RedUSA
674456-UUII200BlueUK
778456-FFTY300YellowGermany
567875-HHYU20BlackChina
452217-PPYU10GreenFiji

 

Table B   
IDAMOUNTDecriptionCountry
23345-TTYU3000RedUSA
11233-YYTY100BlueUK
00156-HYTR50WhiteGermany
778456-FFTY30GreyGermany

 

Table C   
IDAMOUNT DIFFChanges 
674456-UUII No Change 
778456-FFTY   270Yellow Grey 
23345-TTYU No Change 
11233-YYTY 

No Change

 

 

Table C is a summarized table using columns from Table A & B and the Changes column is a calculated column. Ideally, Table C monitors changes between Table A and B. 

The dax code used to calculate the column "AMOUNT DIFF" is;

 

AMOUNT DIFF =

var tab1 = LOOKUPVALUE(Table A[ID],Table A[Amount], Table C[ID])
var tab2 = LOOKUPVALUE(Table B[ID],Table B[Amount], Table C[ID])

Return tab2 - tab1

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.

The error is originating from ID being text and Amount being an Integer. I don't want to change the data type for the variable as it may affect other calculations I have in my data model. How then can I convert either variables (ID and Amount) to text or integer or viceversa?

1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi,

I am not sure if I understood your question correctly, but please try the below calculated column.

I think AMOUNT has to be the first argument in the LOOKUPVALUE function.

 

AMOUNT DIFF CC =
VAR tab1 =
LOOKUPVALUE ( 'Table A'[AMOUNT], 'Table A'[ID], 'Table C'[ID] )
VAR tab2 =
LOOKUPVALUE ( 'Table B'[AMOUNT], 'Table b'[ID], 'Table C'[ID] )
RETURN
tab2 - tab1

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

View solution in original post

3 REPLIES 3
Jihwan_Kim
Super User
Super User

Hi,

I am not sure if I understood your question correctly, but please try the below calculated column.

I think AMOUNT has to be the first argument in the LOOKUPVALUE function.

 

AMOUNT DIFF CC =
VAR tab1 =
LOOKUPVALUE ( 'Table A'[AMOUNT], 'Table A'[ID], 'Table C'[ID] )
VAR tab2 =
LOOKUPVALUE ( 'Table B'[AMOUNT], 'Table b'[ID], 'Table C'[ID] )
RETURN
tab2 - tab1

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.
Anonymous
Not applicable

Worked successfully, Thanks @Jihwan_kin

wdx223_Daniel
Super User
Super User

think it's better to create relationships between these tables by ID

then put the ID columns of Table C on the row, and create a measure

Amount Diff=sum(tableA[Amount)]-sum(TableB[Amount])

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.