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.
I need help to use both "AND" or "OR" in an IF statement in DAX. Here is the formula that generates error:
Failure = if (and(Data[PERCENT1] >= 0,Data[PERCENT1] <= 85) || if(and(Data[PERCENT2]>= 0, Data[PERCENT2] <= 85) || if(and(Data[PERCENT3]>=0,Data[PERCENT3]<=85), "Fail", "Pass")
Basically, trying to determine pass/fail across three columns where a subject who has score <= 85% in any of the three, excluding BLANK, has a fail flag. THe >= 0 is not the best way to get rif of BLANK but it does work.
Thank you
Helal
Solved! Go to Solution.
@helalm , Try like
if ( and(Data[PERCENT1]+0 >= 0,Data[PERCENT1]+0 <= 85) || and(Data[PERCENT2]+0>= 0, Data[PERCENT2]+0 <= 85) || and(Data[PERCENT3]+0>=0,Data[PERCENT3]+0<=85), "Fail", "Pass")
hi @helalm
Here you go
hi @helalm
Here you go
Failure = if (((Data[PERCENT1] >= 0 &&Data[PERCENT1] <= 85) || (Data[PERCENT2]>= 0 && Data[PERCENT2] <= 85) || (Data[PERCENT3]>=0 && Data[PERCENT3]<=85)), "Fail", "Pass")
Thanks!
Thank you...it looks like > 0 don't take care of BLANKS. Can BLANKS be assigned? like 'Failed', 'Passed','BLANKS'?
hi @helalm ,
Do you mean if any of Percent1/Percent2/Percent3 is Blank, assign the value as "Fail"?
Thanks!
hi @Anonymous ,
No, since it seems that blanks have already been accounted for in "Fail". I want to have a separate category as "Blanks". So, the group will be "Fail", "Pass", and "Blanks". Hope it makes sense.
Thank you
hi @helalm
Here you go
Perfect...Thanks a lot.
Helal
hi @helalm ,
Did this work?
If yes, Kindly mark my post as solution!!! Also would appreciate Kudos :)!!!
hi @Anonymous,
Yes, it did work. I am trying to get a variation of the formula and cross check with other variables. Here is the new code:
@helalm , Try like
if ( and(Data[PERCENT1]+0 >= 0,Data[PERCENT1]+0 <= 85) || and(Data[PERCENT2]+0>= 0, Data[PERCENT2]+0 <= 85) || and(Data[PERCENT3]+0>=0,Data[PERCENT3]+0<=85), "Fail", "Pass")
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
113 | |
99 | |
75 | |
73 | |
49 |
User | Count |
---|---|
145 | |
109 | |
109 | |
90 | |
64 |