DAX - OR Statement Required

AndrewKent

Well-known Member
Joined
Jul 26, 2006
Messages
889
Hi all,

I have a rather nifty Dax calculation that gives me everything I need however I need to update it so that it looks at two values in one column than just one. The DAX below Works however there must be a simpler way to do this;

Code:
Standard 12MR Q018 Positive :=
CALCULATE (
    COUNTA ( tbl_data_diversity_leavers_survey[Employee ID] ),
    FILTER (
        ALLEXCEPT (
            tbl_data_diversity_leavers_survey,
            tbl_departments_matrix[WL5 Area],
            tbl_departments_matrix[Functional Area],
            tbl_departments_matrix[Business Area],
            tbl_data_diversity_leavers_survey[Gender],
            tbl_data_diversity_leavers_survey[Work Level],
            tbl_data_diversity_leavers_survey[Overall Area]
        ),
        (
            tbl_data_diversity_leavers_survey[Month ID]
                >= MAX ( tbl_date_matrix[Month ID] ) - 11
        )
            && (
                tbl_data_diversity_leavers_survey[Month ID] <= MAX ( tbl_date_matrix[Month ID] )
            )
    ),
    FILTER (
        ALLEXCEPT (
            tbl_data_diversity_leavers_survey,
            tbl_departments_matrix[WL5 Area],
            tbl_departments_matrix[Functional Area],
            tbl_departments_matrix[Business Area],
            tbl_data_diversity_leavers_survey[Gender],
            tbl_data_diversity_leavers_survey[Work Level],
            tbl_data_diversity_leavers_survey[Overall Area]
        ),
        tbl_data_diversity_leavers_survey[Question ID] = "Q018"
            && tbl_data_diversity_leavers_survey[Survey Completed] = "Completed"
            && tbl_data_diversity_leavers_survey[Answer] = "Strongly Agree"
    )
)
    + CALCULATE (
        COUNTA ( tbl_data_diversity_leavers_survey[Employee ID] ),
        FILTER (
            ALLEXCEPT (
                tbl_data_diversity_leavers_survey,
                tbl_departments_matrix[WL5 Area],
                tbl_departments_matrix[Functional Area],
                tbl_departments_matrix[Business Area],
                tbl_data_diversity_leavers_survey[Gender],
                tbl_data_diversity_leavers_survey[Work Level],
                tbl_data_diversity_leavers_survey[Overall Area]
            ),
            (
                tbl_data_diversity_leavers_survey[Month ID]
                    >= MAX ( tbl_date_matrix[Month ID] ) - 11
            )
                && (
                    tbl_data_diversity_leavers_survey[Month ID] <= MAX ( tbl_date_matrix[Month ID] )
                )
        ),
        FILTER (
            ALLEXCEPT (
                tbl_data_diversity_leavers_survey,
                tbl_departments_matrix[WL5 Area],
                tbl_departments_matrix[Functional Area],
                tbl_departments_matrix[Business Area],
                tbl_data_diversity_leavers_survey[Gender],
                tbl_data_diversity_leavers_survey[Work Level],
                tbl_data_diversity_leavers_survey[Overall Area]
            ),
            tbl_data_diversity_leavers_survey[Question ID] = "Q018"
                && tbl_data_diversity_leavers_survey[Survey Completed] = "Completed"
                && tbl_data_diversity_leavers_survey[Answer] = "Agree"
        )
    )

Looking for an total of all records that have Question ID AND Survey Completed and either Agree or Strongly Agree in Answer. If that makes sense.

Thanks in advance!

Andy
 
Last edited:

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop

Forum statistics

Threads
1,224,828
Messages
6,181,217
Members
453,024
Latest member
Wingit77

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top