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
o59393
Post Prodigy
Post Prodigy

How to use switch with 2 logical conditions

Hi all

 

I am trying to use a switch with 2 logical conditions. Basically if the column "ES-RQ-225-Param" has a certain text and column "Result" is within the specied column "target", then return "in".

 

For example, the targets for the following parameters are:

 

ES-RQ-225ParámTargetLookup
Cloro Residual o Ausente / Chlorine, residual (mg/L) - 0.10.1<
BOD5 (mg/L) - 5050<
Aluminio / Aluminum (mg/L) - 1.51.5<

 

I am using the following formula

 

Column = 
SWITCH(
    TRUE(),
    'Append'[ES-RQ-225Parám]="Cloro Residual o Ausente / Chlorine, residual (mg/L) - 0.1" && 'Append'[Result] < 'Append'[Target],"In",
    'Append'[ES-RQ-225Parám]="BOD5 (mg/L) - 50" && 'Append'[Result] < 'Append'[Target],"In",
    'Append'[ES-RQ-225Parám]="Aluminio / Aluminum (mg/L) - 1.5" && 'Append'[Result] < 'Append'[Target],"In",
    "Out"
)
    

 

As seen, if '[ES-RQ-225Parám]="Cloro Residual o Ausente / Chlorine, residual (mg/L) - 0.1" and [Result] < 'Append'[Target], then I want to have an "In". 

 

In this case for "Cloro Residual o Ausente / Chlorine, residual (mg/L) - 0.1" the target is 0.1 as seen below.

 

However it's returning me an error:

 

sdsada21.JPG

 

How can I get it right?

 

Thanks!

 

1 ACCEPTED SOLUTION
harshnathani
Community Champion
Community Champion

HI @o59393 ,

 

'You need to convert the data type of 'Target Column' to Decimal Number. 

 

 

Regards,
Harsh Nathani
Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

View solution in original post

1 REPLY 1
harshnathani
Community Champion
Community Champion

HI @o59393 ,

 

'You need to convert the data type of 'Target Column' to Decimal Number. 

 

 

Regards,
Harsh Nathani
Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

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.