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

A new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.

Reply
Anonymous
Not applicable

Nested IF loop Formula not working properly

Hi Everyone,
I am facing a problem with defining a formula for a column.
Can anyone help me why am I facing this problem? I have defined a new column called Accuracy with the following logic:
FORMULA:
Estimate_Accuracy = IF(((Event[Est] = 1||2||3) && (Event[Time] = "On Time") && (Event[Quality] = "GOOD")),"Accurate Estimate",IF(Event[Est]=0,"No Estimate","Inaccurate Estimate"))
LOGIC:
If[(Est is between 1 to 3) and (Time = On Time) and (Quality = Good)], then it is "Accurate Estimate"
If[Est is 0], then it is "No Estimate"
Else it is "Inaccurate Estimate"

But strangely I have some rows classified as "Accurate Estimate" even if the Est column is 4. Is my formula wrongly specified?

Kindly let me know how I can correct this mistake.

Many thanks in advance


@amitchandak @Fowmy 
1 ACCEPTED SOLUTION
SteveCampbell
Memorable Member
Memorable Member

When you use OR || you must specify whole statements, not just one side.
E.G. Event[Est] = 1 ||  Event[Est] = 2  ||  Event[Est] =3
You could use IN instead.

 

Also, a SWITCH / TRUE() will be much easier to read

 

 

Estimate_Accuracy = 
SWITCH( TRUE(),
   (Event[Est] IN {1,2,3})  && (Event[Time] = "On Time") && (Event[Quality] = "GOOD")
      ,"Accurate Estimate"
   ,Event[Est]=0
      ,"No Estimate"
      ,"Inaccurate Estimate"
)

 

 

Make sure Event[Est] is numeric otherwise you will need to wrap all numbers in quotes in the DAX



Did I answer your question? Mark my post as a solution! Proud to be a Super User!


Connect with me!
Stay up to date on  
Read my blogs on  



View solution in original post

1 REPLY 1
SteveCampbell
Memorable Member
Memorable Member

When you use OR || you must specify whole statements, not just one side.
E.G. Event[Est] = 1 ||  Event[Est] = 2  ||  Event[Est] =3
You could use IN instead.

 

Also, a SWITCH / TRUE() will be much easier to read

 

 

Estimate_Accuracy = 
SWITCH( TRUE(),
   (Event[Est] IN {1,2,3})  && (Event[Time] = "On Time") && (Event[Quality] = "GOOD")
      ,"Accurate Estimate"
   ,Event[Est]=0
      ,"No Estimate"
      ,"Inaccurate Estimate"
)

 

 

Make sure Event[Est] is numeric otherwise you will need to wrap all numbers in quotes in the DAX



Did I answer your question? Mark my post as a solution! Proud to be a Super User!


Connect with me!
Stay up to date on  
Read my blogs on  



Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors