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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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
July 2024 Power BI Update

Power BI Monthly Update - July 2024

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

July Newsletter

Fabric Community Update - July 2024

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