Forum Discussion
Multiple IF statements under Return
Tanushree_Kapse Thanks for help.
Don't we have to put && or || between lines?
Also, when you mentioned "measure", do you mean, put your suggested code in a separate measure and insert the measure inside the original code? Thanks.
Hi JustinDoh1 ,
We are putting OR and AND statements instead of them.
Also, put this statements in your Return part of your existing measure.
Thanks
- JustinDoh15 years ago
Post Prodigy
Tanushree_Kapse Thanks for quick reply. While I am still trying to put your code so that there is no error message, I have a quick question. So, in DAX we do not use && or || ? I am looking at other part of code where I used && and ||.
BTW, I am trying to apply your code here, but I am not sure I am doing it right.
- JustinDoh15 years ago
Post Prodigy
Tanushree_Kapse Thank you very much for prompt reply. I just pasted the code under RETURN (before indenting), but getting "Too many arguments were passed to the ADN function. The maximum arguent count for the function is 2" error. Where am I mssing? Thank you.
This is screenshot after I tried to break down your code into 4 parts..
Are we mssing ( and one IF statement?
- Tanushree_Kapse5 years ago
Impactful Individual
Hi JustinDoh1 ,
There's error in syntax.. brackets.
Try this, see if this helps.
IF(OR(OR(AND(AND (min(Table1[step])= 1,NOT (min(Table1[Consent])= "Refused")), min(Table1[Consentdate])<> blank()), IF(AND(AND (max(Table1[step])= 2 ,NOT (max(Table1[Consent])= "Refused")), max(Table1[Consentdate])<> blank()), AND(AND (min(Table1[step])= 1,NOT (min(Table1[Consent])= "Refused"), min(Table1[Consentdate])<> blank())), IF(AND(AND (min(Table1[step])= 1,NOT (min(Table1[Consent])= "Refused")), vimmunization < vconsent)), 0, vrefused)
AND takes two arguments, so does OR...put the brackets accordingly.
- JustinDoh15 years ago
Post Prodigy
Tanushree_Kapse Thank you so much for your reply. Sorry. I am still struggling.
Also, there are three options under IF --> 0 and then Otherwise --> vRefused.
It appears that we have four.
- JustinDoh15 years ago
Post Prodigy
Tanushree_Kapse I decided to try SWITCH, and actaully it worked magically.
Sorry, the table name is different as I was using Production table here.