cancel
Showing results for 
Search instead for 
Did you mean: 
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
Super User
Super User

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
Super User
Super User

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

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Power BI October Update 2021.jpg

Power BI Release

Click here to read more about the October 2021 Release!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Teds Dev Camp Oct. 2021 768x460.jpg

Power BI Dev Camp - October 28th, 2021

Mark your calendars and join us for our next Power BI Dev Camp!