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
chris05
Frequent Visitor

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

Hi 

I'm new to Power BI. Can anyone help me on this error, please "Expressions that yield variant data-type cannot be used to define calculated columns"

 

RemainingSlots = SWITCH( TRUE(),
[Max] = 0, "x",
[Max] - [Min] = 0, "full",

[Max] - [Min] < 0, "less",

[Max] - [Min] > 0, [Max] - [Min]
)

on the last part, I wanted to get the value of the diference of these columns if the difference is >0. Note: it is working without the last part. All column formats are set to Whole Number. not sure what I miss 😞

Thanks in advance!

 

1 ACCEPTED SOLUTION
lbendlin
Super User
Super User

You are trying to return both text and numbers in that column,

 

RemainingSlots = SWITCH( TRUE(),
[Max] = 0, "x",
[Max] - [Min] = 0, "full",

[Max] - [Min] < 0, "less",

[Max] - [Min] > 0, FORMAT([Max] - [Min],"#")
)

View solution in original post

1 REPLY 1
lbendlin
Super User
Super User

You are trying to return both text and numbers in that column,

 

RemainingSlots = SWITCH( TRUE(),
[Max] = 0, "x",
[Max] - [Min] = 0, "full",

[Max] - [Min] < 0, "less",

[Max] - [Min] > 0, FORMAT([Max] - [Min],"#")
)

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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