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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.