Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
JustinDoh1
Post Prodigy
Post Prodigy

Multiple IF statements under Return

I am sharing my Pbix file here.

 

I am trying to have multiple IF statements under Retrurn statement.

I was able to possibly have up to 2 options, when I got to 3 options, I am not sure I am doing it right with || (or) statements.

 

The measure is called "Refused 0817_A" in the file.

JustinDoh1_0-1629248545216.png

Basically, the logic is:

If any of 3 conditions is met (OR), the output should be 0, otherwise, output should be vRefused.

 

I am not sure whether applying SWITCH() works under statement like this where we put under RETURN.

That is the main reason that I am trying to clarify as well.

Thanks.

 

8 REPLIES 8
JustinDoh1
Post Prodigy
Post Prodigy

@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

@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.

JustinDoh1_1-1629307548532.png

 

This is screenshot after I tried to break down your code into 4 parts..

Are we mssing ( and one IF statement?

JustinDoh1_3-1629308766849.png

 

 

 

@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.

JustinDoh1_1-1629320121189.png

 

 

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.

 

@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.

JustinDoh1_2-1629311911926.png

 

@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 ||. 

JustinDoh1_0-1629304004089.png

BTW, I am trying to apply your code here, but I am not sure I am doing it right. 

JustinDoh1_2-1629304725857.png

 

 

Tanushree_Kapse
Impactful Individual
Impactful Individual

Hi @JustinDoh1 ,

 

Try this measure for return statement:

 

Return 

IF(OR(OR(AND(AND (min(Table1[step])= 1,NOT (min(Table1[Consent])= "Refused"), min(Table1[Consentdate])<> blank()), IFAND(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)

 

 

I hope this helps!

 

Mark this as a solution if I answered your question. Kudos are always appreciated.

Thanks!

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.