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 September 15. Request your voucher.

Reply
tbennett
Frequent Visitor

Nested IF with AND and OR

I'm pretty new to PowerBI and I've hit a bit of a stumbling block when it comes to nested if's with AND and OR's.  I've had a good look at previous posts and I'm even more confused as I've seen comments about using the SWITCH function instead, so not sure which I should be using.

 

I want to create a new column that is populated based on the data in two different columns.

 

If column 1 contains "Pass" or "Intermediate Award" or "Proceed Carry" AND column 2 = "Did not return" then return the value of "Eligible to Return".

 

This is part of a more longer IF statement, but the rest is based on one column of data.  So far I have:

 

Progression = if(and(Sheet1[FY_COURSE_LEVEL_CODE]="UGN",Sheet1[COURSE_LEVEL_CODE]="UGD"),"Did not Progress to Higher Level",if(Sheet1[FY_MODE_OF_STUDY_CODE]="PART_TIME","Did not Progress to Higher Level",if(Sheet1[FY_YEAR_OF_COURSE]<=Sheet1[YEAR_OF_COURSE],"Did not Progress to Higher Level",**,"")))

 

I need to add the if with OR and AND into this statement **

 

Is there a simple way of doing this?  Any help would be very much appreciated.

1 ACCEPTED SOLUTION
MFelix
Super User
Super User

Hi @tbennett,

 

You should take a look at the SWITCH statment (link) to do your IF instead of doing nested IF.

 

Regarding the AND you should use &&  for the OR you should use the || as divider.

 

Regards,

MFelix

 

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

3 REPLIES 3
MFelix
Super User
Super User

Hi @tbennett,

 

You should take a look at the SWITCH statment (link) to do your IF instead of doing nested IF.

 

Regarding the AND you should use &&  for the OR you should use the || as divider.

 

Regards,

MFelix

 

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Many thanks both for you prompt responses! 

Greg_Deckler
Community Champion
Community Champion

Without sample data, your IF is going to look something like:

 

IF (
	AND (
		OR (
			OR (
				SEARCH("Pass",[Column 1],1,0),
				SEARCH("Intermediate Award",[Column 1],1,0)
			   ),
			SEARCH("Proceed Carry",[Column 1],1,0)
		   ),
		[Column 2] = "Did not return"
	    ),
        "Eligible to Return",
        "Not Eligible"
    )


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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