cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
pbrainard
Helper III
Helper III

If Statement with multiple conditions

I have this if statement:

AMI30% =
IF( 'Case'[csAnnualIncomeEntry] <= 27200 && MIN('Case'[csHouseholdSize]) = 1, "True", "False" )
 
I want to do this logic a few times incorporating [csAnnualIncomeEntry] <= 31050 and HouseholdSize = 2, 34950 and 3, etc.
1 ACCEPTED SOLUTION
jdbuchanan71
Super User
Super User

@pbrainard 

Try it in a SWITCH statement like this.

AMI30% =
SWITCH (
    TRUE (),
    'Case'[csAnnualIncomeEntry] <= 27200 && MIN ( 'Case'[csHouseholdSize] ) = 1, "True",
    'Case'[csAnnualIncomeEntry] <= 31050 && MIN ( 'Case'[csHouseholdSize] ) = 2, "True",
    'Case'[csAnnualIncomeEntry] <= 34950 && MIN ( 'Case'[csHouseholdSize] ) = 3, "True",
    "False"
)

View solution in original post

3 REPLIES 3
jdbuchanan71
Super User
Super User

@pbrainard 

Try it in a SWITCH statement like this.

AMI30% =
SWITCH (
    TRUE (),
    'Case'[csAnnualIncomeEntry] <= 27200 && MIN ( 'Case'[csHouseholdSize] ) = 1, "True",
    'Case'[csAnnualIncomeEntry] <= 31050 && MIN ( 'Case'[csHouseholdSize] ) = 2, "True",
    'Case'[csAnnualIncomeEntry] <= 34950 && MIN ( 'Case'[csHouseholdSize] ) = 3, "True",
    "False"
)

Thank you!!! Good to see the SWITCH in action. Been looking for this fix!!!!

Anonymous
Not applicable

Hello @pbrainard , you can use switch instead of if, when your cases are more than two. 

here is the link with details :

SWITCH function (DAX) - DAX | Microsoft Docs

I hope it helps you.

Helpful resources

Announcements
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors