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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

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
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Kudoed Authors