Forum Discussion
Multiple IF, AND conditions
- Anonymous1 year ago
Hi JK-1,
Thank you for reaching out in Microsoft Community Forum.
The only issue with the formula you posted is a small syntax error in the IF condition. In DAX, all conditions need to be separated by logical operators like &&, and each condition must return a TRUE/FALSE result.
please use the below DAX to resolve the error;
OnFlagCC =
IF (
SubsidyData[StoreNumber] = 83 &&
CONTAINSSTRING(SubsidyData[Leader], "ON") &&
SubsidyData[Subsidy] >= -100 &&
SubsidyData[Subsidy] <= 100,
1,
0
)Please continue using Microsoft Community Forum.
If this post helps in resolve your issue, kindly consider marking it as "Accept as Solution" and give it a 'Kudos' to help others find it more easily.
Regards,
Pavan.
Thank you so much, seeing this presented helped me work through it in stages.
I see I had an initial conflict in that one leader's name contains On and also had an OFF .. ie Sharon OFF but the logic has very much helped in unravelling.
The only other thing I had a different difficulty on was trying to combine queries within IF using other columns. Whilst I have seen && THEN , { } etc I think I'm struggling with the basics on how to adapt where necessary..
Obviously don't want to take up more of your time with something that is probably simple, and not initially discussed in the opener. Since you were very kindly able to help answer everything in the question(s) posed. Cheers,
combine .. use only on StoreNumber given, how to?
Hi JK-1,
Thank you for reaching out in Microsoft Community Forum.
The only issue with the formula you posted is a small syntax error in the IF condition. In DAX, all conditions need to be separated by logical operators like &&, and each condition must return a TRUE/FALSE result.
please use the below DAX to resolve the error;
OnFlagCC =
IF (
SubsidyData[StoreNumber] = 83 &&
CONTAINSSTRING(SubsidyData[Leader], "ON") &&
SubsidyData[Subsidy] >= -100 &&
SubsidyData[Subsidy] <= 100,
1,
0
)
Please continue using Microsoft Community Forum.
If this post helps in resolve your issue, kindly consider marking it as "Accept as Solution" and give it a 'Kudos' to help others find it more easily.
Regards,
Pavan.