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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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