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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
AndrewKent
Helper I
Helper I

DAX - Multiple Conditions

Hi all,

 

I have a rather nifty DAX calculation that gives me a rolling 12 month position on my data, based on one criteria. How do I update this so that it includes a second criteria of tbl_data_diversity_recruitment[Stage] = "e. Hired";

 

Hired 12MR Male:=CALCULATE (
    COUNTA ( tbl_data_diversity_recruitment[Requisition ID] ),
    FILTER (
        ALLEXCEPT (
            tbl_data_diversity_recruitment,
            tbl_departments_matrix[WL5 Area],
            tbl_departments_matrix[Functional Area],
            tbl_departments_matrix[Business Area],
            tbl_departments_matrix[Type],
            tbl_data_diversity_recruitment[Overall Area],
            tbl_data_diversity_recruitment[Stage],
            tbl_data_diversity_recruitment[Work Level]
        ),
        (
            tbl_data_diversity_recruitment[Month ID]
                >= MAX ( tbl_date_matrix[Month ID] ) - 11
        )
            && ( tbl_data_diversity_recruitment[Month ID] <= MAX ( tbl_date_matrix[Month ID] ) )
    ),
    FILTER (
        ALLEXCEPT (
            tbl_data_diversity_recruitment,
            tbl_departments_matrix[WL5 Area],
            tbl_departments_matrix[Functional Area],
            tbl_departments_matrix[Business Area],
            tbl_departments_matrix[Type],
            tbl_data_diversity_recruitment[Overall Area],
            tbl_data_diversity_recruitment[Stage],
            tbl_data_diversity_recruitment[Work Level]
        ),
        tbl_data_diversity_recruitment[Gender] = "Male"
    )
)

Cheers,

 

 

Andy

1 ACCEPTED SOLUTION
KHorseman
Community Champion
Community Champion

The same way you already added a second condition to your first filter statement. &&

 

Hired 12MR Male:=CALCULATE (
    COUNTA ( tbl_data_diversity_recruitment[Requisition ID] ),
    FILTER (
        ALLEXCEPT (
            tbl_data_diversity_recruitment,
            tbl_departments_matrix[WL5 Area],
            tbl_departments_matrix[Functional Area],
            tbl_departments_matrix[Business Area],
            tbl_departments_matrix[Type],
            tbl_data_diversity_recruitment[Overall Area],
            tbl_data_diversity_recruitment[Stage],
            tbl_data_diversity_recruitment[Work Level]
        ),
        (
            tbl_data_diversity_recruitment[Month ID]
                >= MAX ( tbl_date_matrix[Month ID] ) - 11
        )
            && ( tbl_data_diversity_recruitment[Month ID] <= MAX ( tbl_date_matrix[Month ID] ) )
    ),
    FILTER (
        ALLEXCEPT (
            tbl_data_diversity_recruitment,
            tbl_departments_matrix[WL5 Area],
            tbl_departments_matrix[Functional Area],
            tbl_departments_matrix[Business Area],
            tbl_departments_matrix[Type],
            tbl_data_diversity_recruitment[Overall Area],
            tbl_data_diversity_recruitment[Stage],
            tbl_data_diversity_recruitment[Work Level]
        ),
        tbl_data_diversity_recruitment[Gender] = "Male"
&& tbl_data_diversity_recruitment[Stage] = "e. Hired" ) )




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

4 REPLIES 4
KHorseman
Community Champion
Community Champion

The same way you already added a second condition to your first filter statement. &&

 

Hired 12MR Male:=CALCULATE (
    COUNTA ( tbl_data_diversity_recruitment[Requisition ID] ),
    FILTER (
        ALLEXCEPT (
            tbl_data_diversity_recruitment,
            tbl_departments_matrix[WL5 Area],
            tbl_departments_matrix[Functional Area],
            tbl_departments_matrix[Business Area],
            tbl_departments_matrix[Type],
            tbl_data_diversity_recruitment[Overall Area],
            tbl_data_diversity_recruitment[Stage],
            tbl_data_diversity_recruitment[Work Level]
        ),
        (
            tbl_data_diversity_recruitment[Month ID]
                >= MAX ( tbl_date_matrix[Month ID] ) - 11
        )
            && ( tbl_data_diversity_recruitment[Month ID] <= MAX ( tbl_date_matrix[Month ID] ) )
    ),
    FILTER (
        ALLEXCEPT (
            tbl_data_diversity_recruitment,
            tbl_departments_matrix[WL5 Area],
            tbl_departments_matrix[Functional Area],
            tbl_departments_matrix[Business Area],
            tbl_departments_matrix[Type],
            tbl_data_diversity_recruitment[Overall Area],
            tbl_data_diversity_recruitment[Stage],
            tbl_data_diversity_recruitment[Work Level]
        ),
        tbl_data_diversity_recruitment[Gender] = "Male"
&& tbl_data_diversity_recruitment[Stage] = "e. Hired" ) )




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




I thought so too but I get the "tbl_data_diversity_recruitment cannot be determined in the current contexT" error message. Any thoughts?

Oh I just noticed you have that [Stage] column referenced in the ALLEXCEPT statement. So you can't filter on it because you just told it not to filter on it.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Works perfectly! thank you!

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.