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 September 15. Request your voucher.

Reply
Anonymous
Not applicable

"Expressions that yield variant data-type cannot be used to define calculated columns" error.

Hi all, 

 

So I executed the following function 

 

Column = SWITCH(TRUE(),
Column[A] = "Group 1" && [Income] > 99000, "25000",

Column[B] = "Group2" && [Income] > 99000, "35000",

Column[C] = "Group 3" && [Income] > 99000, "45000",
[Income]) 

 

 

And I get the "Expressions that yield variant data-type cannot be used to define calculated columns" error.  Column[A] is in text format & [Income] is a Number. 

Could someone kindly assist on how to get around this problem 

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

Hi, @Anonymous 

Based on the error message, it is caused by the different data types in column. 

"25000", "35000","45000"  is in Text format while [Income] is in Number format.

You need to keep the data types in the same column consistent.

You can change the  data type of column [Income] to “Text”.

 

Best Regards,
Community Support Team _ Eason

 

View solution in original post

2 REPLIES 2
v-easonf-msft
Community Support
Community Support

Hi, @Anonymous 

Based on the error message, it is caused by the different data types in column. 

"25000", "35000","45000"  is in Text format while [Income] is in Number format.

You need to keep the data types in the same column consistent.

You can change the  data type of column [Income] to “Text”.

 

Best Regards,
Community Support Team _ Eason

 

tamerj1
Super User
Super User

Hi @Anonymous 

you can try

Column =
SWITCH (
    TRUE (),
    Column[A] = "Group 1"
        && [Income] > 99000, 25000,
    Column[B] = "Group2"
        && [Income] > 99000, 35000,
    Column[C] = "Group 3"
        && [Income] > 99000, 45000,
    [Income]
)

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Kudoed Authors