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
bhelou
Responsive Resident
Responsive Resident

expressions that yield variant data-type

Hello Community ,

 

i made this formula and its makinf # error ( expressions that yeild variant data-type cannot be used to define calculated columns 

 

Employee_Name = IF(Employee_ID_Name[lookup_Name]="",Employee_ID_Name[EMPLOYEE_ID],Employee_ID_Name[lookup_Name])
 
* (Employee_ID_Name[lookup_Name] : is coming from a related formula and working
 
i have changed the lookup_name to ID the formula is working but when it is text its not 
I have changed the formula : replaced "" with blank() , didnt work 
I have changed the formula : replaced "" with 0, didnt work 
 
Thank you for help.
 
 

 

1 ACCEPTED SOLUTION
v-xuding-msft
Community Support
Community Support

Hi @bhelou ,

I guess the column of EMPLOYEE_ID is number type and the lookup_Name is the text type. Your expression returns either number or text. But the data in calculated column need to be the same type. You could try using the function of FORMAT to return the EMPLOYEE_ID to text.

Employee_Name =
IF (
    Employee_ID_Name[lookup_Name] = "",
    FORMAT ( Employee_ID_Name[EMPLOYEE_ID], "" ),
    Employee_ID_Name[lookup_Name]
)

 

Best Regards,
Xue Ding
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-xuding-msft
Community Support
Community Support

Hi @bhelou ,

I guess the column of EMPLOYEE_ID is number type and the lookup_Name is the text type. Your expression returns either number or text. But the data in calculated column need to be the same type. You could try using the function of FORMAT to return the EMPLOYEE_ID to text.

Employee_Name =
IF (
    Employee_ID_Name[lookup_Name] = "",
    FORMAT ( Employee_ID_Name[EMPLOYEE_ID], "" ),
    Employee_ID_Name[lookup_Name]
)

 

Best Regards,
Xue Ding
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.