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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
Anonymous
Not applicable

SWITCH function with result TEXT

Hello all,

 

I have something pretty simple i guess, but i can not figure this out how with DAX.

I am looking for a result "Yes"or "No" as text.

 

On TimeCorrectionResult
YesYesYes
YesemptyYes
emptyemptyempty

 

 

 

Already tried this with the "IF"/"AND" function and the "SWITCH" function like this.

Result = switch(true(),Tbl[On Time]="Ja","Ja",Tbl[On Time]="","",Tbl[On Time]="Nee" && Tbl[Correction]="Ja","Ja")

 

The error i become is:

DAX comparison operations do not support comparing values of type True/False with values of type Text. Consider using the VALUE or FORMAT function to convert one of the values.

 

I do not understand this error because i am not working with any True/False type.

Only with text("Yes"/"No" or an empty cell)

 

What do i miss?

 

 

Thank you.

 

Gr Alfons

 

6 REPLIES 6
v-janeyg-msft
Community Support
Community Support

@Anonymous  Any updates?

v-janeyg-msft
Community Support
Community Support

Hi, @Anonymous 

 

Is your problem been solved? Have you checked the data and data type of the Tbl[Correction] column in PQ?

 

Best Regards

Janey Guo

 

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

FrankAT
Community Champion
Community Champion

Hi @Anonymous ,

you can do it like this:

 

02-06-_2021_23-38-29.png

 

 

 

Result = SWITCH(TRUE(),
    MIN('Tbl'[On Time]) = "Ja", "Ja",
    MIN('Tbl'[On Time]) = " ", " ",
    MIN('Tbl'[On Time]) = "Nee" && MIN('Tbl'[Correction]) = "Ja", "Ja"
)

 

With kind regards from the town where the legend of the 'Pied Piper of Hamelin' is at home
FrankAT (Proud to be a Datanaut)

HotChilli
Super User
Super User

Looks ok from here so you'll have to debug at your side.  Presumably it's the 3rd clause causing problems.  You can comment it out to test.

Have you definitely got && as the logical 'and'?  Maybe you could test with e.g. 

Result2 = switch(true,
Tbl[On Time]="Yes", "Yes",
Tbl[On Time]="", "",
AND(Tbl[On Time]="No", 1), "Yes")  to see if you can get past the error
Anonymous
Not applicable

Hello HotChilli,

 

Thanks,

 

But unfortunately, i can not solve it.

I tried it with your proposal.

Result = Switch(TRUE(,

Tbl[On Time]="Ja","Ja",

Tbl[On Time]="","",

AND(Tbl[On Time ]="Ja",Tbl[Correction]="Ja"),"")

 

Error:

DAX comparison operations do not support comparing values of type True/False with values of type Text. Consider using the VALUE or FORMAT function to convert one of the values.

 

If i am leaving the last part of the formula from the "AND" function away, it works find.

But of couse misses the last part.

So is has something to do something with this combined conditions.

 

Do you have other options?

 

Gr

Anonymous
Not applicable

Sorry ,

 

First On Time value in table has to be "No".

 

 

Gr,

 

 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.