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
akito
Frequent Visitor

IF with multiple condition (more than 3) + DAX formula help needed

Hi Masters,

 

I am pretty new in DAX as well as in Power BI. 

 

Please see below snapshots : Basically I am trying to mark/tag my projects with specific words based on their approval statuses. I have 3 types of approvals and if all have "Yes" I would like to write and tag that project as "F-R-W" whcih stands for "Finance - Risk  - Workstream". I am able to do this in excel table where I have one table. However now I am trying to do this in database where I have many tables with relationships. It is not only question around multiple AND conditon with IF, it is also how I can do this in  database where I have multiple tables . Please check snapshots and i hope you will understand what I am trying to do. 

 

Excel formula that I used to use:

akito_1-1652864001447.png

In DAX  - what I am trying to do

akito_0-1652863987458.png

Expected DAX outcome:

akito_2-1652864062605.png

 

Regards,

Akito

1 ACCEPTED SOLUTION
v-cgao-msft
Community Support
Community Support

Hi @akito ,

 

Try this measure.

Required Approvals = 
VAR _finance_approvals =
    MAX ( 'Initiative Pending Approval'[Finance Approvals] )
VAR _risk_approvals =
    MAX ( 'Initiative Pending Approval'[Risk Approvals] )
VAR _workstream_approvals =
    MAX ( 'Initiative Pending Approval'[Workstream Approvals] )
RETURN
    SWITCH (
        TRUE (),
        _finance_approvals = "Yes"
            && _risk_approvals = "Yes"
            && _workstream_approvals = "Yes", "F-R-W",
        _finance_approvals = "Yes"
            && _risk_approvals = "Yes"
            && _workstream_approvals = "", "F-R",
        _finance_approvals = "Yes"
            && _risk_approvals = ""
            && _workstream_approvals = "", "F"
    )

vcgaomsft_0-1653298201200.png

Attached PBIX file for reference.

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly -- How to provide sample data

View solution in original post

2 REPLIES 2
akito
Frequent Visitor

Thanks a lot @v-cgao-msft  - this worked very well. 

v-cgao-msft
Community Support
Community Support

Hi @akito ,

 

Try this measure.

Required Approvals = 
VAR _finance_approvals =
    MAX ( 'Initiative Pending Approval'[Finance Approvals] )
VAR _risk_approvals =
    MAX ( 'Initiative Pending Approval'[Risk Approvals] )
VAR _workstream_approvals =
    MAX ( 'Initiative Pending Approval'[Workstream Approvals] )
RETURN
    SWITCH (
        TRUE (),
        _finance_approvals = "Yes"
            && _risk_approvals = "Yes"
            && _workstream_approvals = "Yes", "F-R-W",
        _finance_approvals = "Yes"
            && _risk_approvals = "Yes"
            && _workstream_approvals = "", "F-R",
        _finance_approvals = "Yes"
            && _risk_approvals = ""
            && _workstream_approvals = "", "F"
    )

vcgaomsft_0-1653298201200.png

Attached PBIX file for reference.

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly -- How to provide sample data

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.

Top Solution Authors