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
rambler
Regular Visitor

LOOKUPVALUE: Expressions that yield variant data-type cannot be used to define calculated columns

Hi All

 

This error message has been addressed in multiple posts, but I cannot seem to find a solution for my LOOKUPVALUE problem.

 

I have two imported tables that I want to use a LOOKUP value DAX formula in.

Table1

Column1 Int64

 

Table2

Column1 Int64

Column2 text

(taken from the metadata in PowerQuery)

 

Formula in table1 for a calculated column:

ColName = LOOKUPVALUE(Table2[Column2], Table2[Column1], Table1[Column1], 0)

 

This brings back the error message, "Expressions that yield variant data-type cannot be used to define calculated columns"

 

Any idea on how to cast or covert values?

1 ACCEPTED SOLUTION
Zubair_Muhammad
Community Champion
Community Champion

@rambler 

 

try this

 

ColName =
LOOKUPVALUE ( Table2[Column2], Table2[Column1], Table1[Column1], 0 & "" )

Regards
Zubair

Please try my custom visuals

View solution in original post

4 REPLIES 4
Zubair_Muhammad
Community Champion
Community Champion

@rambler 

 

try this

 

ColName =
LOOKUPVALUE ( Table2[Column2], Table2[Column1], Table1[Column1], 0 & "" )

Regards
Zubair

Please try my custom visuals

@Zubair_Muhammad 

 

Thank you so much! That gives the exact result that I am after!  🙂

Thank you also for the swiftness of your response.

 

Just out of interest, how does that addition work?

 

kind regards

Rambler

 

 

@rambler 

 

Hi,

It just converts the datatype of alternate result from a number 0 to text 0 which is consistent with the datatype of Table2[Column2] which you are looking for.

All values in the column must have same data type


Regards
Zubair

Please try my custom visuals

@Zubair_Muhammad  - thanks for the explanation!

 

Rambler

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.