Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
Anonymous
Not applicable

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

i get an error while having the below caluclated column
IF('Scores'[Current/Last]="-","-",IF('Scores'[Question Scores]<>0, IF(_score='Scores'[Question Scores],0,_score) ))
 
Do anyone know how to solve the error? 
5 REPLIES 5
Greg_Deckler
Community Champion
Community Champion

@Anonymous Try below. You either need to return all text or all numbers, not text and numbers.

IF('Scores'[Current/Last]="-","-",IF('Scores'[Question Scores]<>0, IF(_score='Scores'[Question Scores],"0",_score & "") ))

 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

But if i return it into calculated column, it will return error as well. Or i need to use the format function in DAX? if yes, how should it be like?

@Anonymous The measure I posted returns all text. Alternatively, you could write the formula this way to return either BLANK or numbers and it would work as well:

IF('Scores'[Current/Last]="-",BLANK(),IF('Scores'[Question Scores]<>0, IF(_score='Scores'[Question Scores],0,_score) ))


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

But exactly want "-", as i need to use "-" in the report view if it is no data instead of just blank. Any idea for that?

@Anonymous Use the first formula then. Bottom line, you either need to return text or return numbers. You *might* be able to use the second form for a number and use a Custom Format String to display your blank values as "-". Use custom format strings in Power BI Desktop - Power BI | Microsoft Learn



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

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 Solution Authors