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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
Anonymous
Not applicable

IF statement with several conditions

 
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi all, thank you for your kind replies!! I managed to get the results using the formula below after several attempts 🙂 

 

Formula:
image.png

 

 

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi all, thank you for your kind replies!! I managed to get the results using the formula below after several attempts 🙂 

 

Formula:
image.png

 

 

Anonymous
Not applicable

Hi @Anonymous,

 

The way you tried to build this is via a nested if. This is possible, but the best solution is using @vcastello's Switch function here since its faster on execution and also much easier to understand for a large number of possible criteria. If you really want this as a nested if, it should look something like this:

If( Arrears[TCMRScoring_ArrearsAcct %] < 3 = 5,
  If( Arrears[TCMRScoring_ArrearsAcct %] < 4 = 4,
    If( Arrears[TCMRScoring_ArrearsAcct %] < 5 = 3,
      If( Arrears[TCMRScoring_ArrearsAcct %] < 6 = 2, 1
      )
    )
  )
)

 

The difference with your function being that you tried to use OR ( || ) instead of inputting a new If-function as the FALSE result of the previous If-function.
  
As @vcastello mentioned, you should wrap Arrears[TCMRScoring_ArrearsAcct %], as the above will now give an error if there are multiple values for Arrears[TCMRScoring_ArrearsAcct %] in the current filter context. So for example, you could test a Min(Arrears[TCMRScoring_ArrearsAcct %]) to ensure the maximum 'points' are awarded based on the smallest Arrears[TCMRScoring_ArrearsAcct %] in the current context. The nested if would then look something like this:

If( Min( Arrears[TCMRScoring_ArrearsAcct %] ) < 3, 5,
  If( Min( Arrears[TCMRScoring_ArrearsAcct %] ) < 4, 4,
    If( Min( Arrears[TCMRScoring_ArrearsAcct %] ) < 5, 3,
      If( Min( Arrears[TCMRScoring_ArrearsAcct %] ) < 6, 2, 1
      )
    )
  )
)

 

You can replace the Min() function with whatever function you actually need for your specific problem, but some way to handle the possibility of multiple values for Arrears[TCMRScoring_ArrearsAcct %] in your current filter context is necessary.

vcastello
Resolver III
Resolver III

Hi @Anonymous

You can try SWITCH.

 

Should something like this work?


SWITCH(
    TRUE (),
    VALUES(Arrears[TCMRScoring_ArrearsAcct %]) < 3, 5,
    VALUES(Arrears[TCMRScoring_ArrearsAcct %]) < 4, 4,

    VALUES(Arrears[TCMRScoring_ArrearsAcct %]) < 5, 3,
    VALUES(Arrears[TCMRScoring_ArrearsAcct %]) < 6, 2,
     1
)

 

Anyway, your Arrears[TCMRScoring_ArrearsAcct %] should be wrapped. With VALUES, SUM, or other function


Hope That Helps

Vicente

BeemsC
Resolver III
Resolver III

I do it the like this:

Name = IF('Table'[Column] = "" ; "" ; "" ) & IF('Table'[Column] = "" ; "" ; "" ) & IF

etc ...

  + You need to be more specific, because things that are ❤️ can be <4 aswell, if you understand what i mean

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 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.