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
lukeshaffer
Regular Visitor

Nesting AND, OR Commands - DAX

I've grouped projects from a dataset, with the groups reflecting what phase of the process they're in (4 total). I'm trying to create a graph to both show the phases and whether the projects are on track. The only way I can come up with doing this is nesting 4 AND functions inside an OR function, with the idea being that each AND function would correspond to on/off track for each phase. I can't seem to get this working. Here are the functions I have so far:

 

Sample AND Function

IF(AND('TM Dashboard'[Current Schedule Step (groups)] = "Phase 1 - Site Selection",'TM Dashboard'[Days Open]<72,"On Schedule", "Behind Schedule")

 

Initial (broken) Nested Function Idea

Schedule Status = IF(OR((AND('TM Dashboard'[Current Schedule Step (groups)] = "Phase 1 - Site Selection",'TM Dashboard'[Days Open]<72,"On Schedule", "Behind Schedule"),(AND('TM Dashboard'[Current Schedule Step (groups)] = "Phase 2 - Leasing & Design",'TM Dashboard'[Days Open]<140, "On Schedule", "Behind Schedule")))))))
 
Do any of you know how to get this working or have a better way of doing this?
 
Thank you!
3 REPLIES 3
az38
Community Champion
Community Champion

hi @lukeshaffer 

if I understand you correct try SWITCH()

Schedule Status = SWITCH(TRUE(),
AND('TM Dashboard'[Current Schedule Step (groups)] = "Phase 1 - Site Selection", 'TM Dashboard'[Days Open]<72), "On Schedule",
AND('TM Dashboard'[Current Schedule Step (groups)] = "Phase 2 - Leasing & Design", 'TM Dashboard'[Days Open]<140), "On Schedule", 
"Behind Schedule"
)

do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn
Greg_Deckler
Community Champion
Community Champion

Sample data would really help to understand what you are doing. Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490



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

Thank you, @Greg_Deckler! I appreciate your patience, as this is the first time I've had a question I couldn't find answered elsewhere. I know it's got to be simple, but it's beyond me right now. Does this work for the data?

 

Days Open

Current Schedule Step (groups)

Schedule Status

352Phase 1 - Site Selection 
345Phase 2 - Leasing & Design 
305

Phase 3 - Permitting & Construction

 
274Phase 4 - Move 
262Phase 1 - Site Selection 
234Phase 2 - Leasing & Design 
234Phase 3 - Permitting & Construction 
196Phase 4 - Move 
193Phase 1 - Site Selection 
193Phase 2 - Leasing & Design 
183Phase 3 - Permitting & Construction 
177Phase 4 - Move 
177Phase 1 - Site Selection 
177Phase 2 - Leasing & Design 
177Phase 3 - Permitting & Construction 
176Phase 4 - Move 
176Phase 1 - Site Selection 
176Phase 2 - Leasing & Design 
171Phase 3 - Permitting & Construction 
171Phase 4 - Move 
168Phase 1 - Site Selection 
165Phase 2 - Leasing & Design 
151Phase 3 - Permitting & Construction 
119Phase 4 - Move 
113Phase 1 - Site Selection 
101Phase 2 - Leasing & Design 
101Phase 3 - Permitting & Construction 
92Phase 4 - Move 
87Phase 1 - Site Selection 
79Phase 2 - Leasing & Design 
78Phase 3 - Permitting & Construction 
78Phase 4 - Move 
71Phase 1 - Site Selection 
71Phase 2 - Leasing & Design 
71Phase 3 - Permitting & Construction 
57Phase 4 - Move 
45Phase 1 - Site Selection 
45Phase 2 - Leasing & Design 
45Phase 3 - Permitting & Construction 
45Phase 4 - Move 
28Phase 1 - Site Selection 
17Phase 2 - Leasing & Design 
16Phase 3 - Permitting & Construction 
11Phase 4 - Move 
11Phase 1 - Site Selection 
8Phase 2 - Leasing & Design 
8Phase 3 - Permitting & Construction 
8Phase 4 - Move 
8Phase 1 - Site Selection 
8Phase 2 - Leasing & Design 
7Phase 3 - Permitting & Construction 
2Phase 4 - Move 
1Phase 1 - Site Selection 
1Phase 2 - Leasing & Design 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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