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

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

Reply
Kosh
Frequent Visitor

DAX function to apply OR condition on multiple columns based on Slicers

Hi,

 

I have multiple slicers (Location, Gender, Age, etc). I want to count all rows for any value which matches with the slicer selection.

Example - If user selected Location=US, UK + Gender=Female + Age=18-24 Years, the output should be anyone who is from Locations = US or UK, OR Gender is Female OR Age is 18-24 Years.

 

I tried below formula but not working.

SelectedEmployees =
CALCULATE(
    COUNTROWS(tblData),
    FILTER(
        'tblData',
        (tblData[Location] in VALUES(tbLocations[Locations]) ||
        tblData[Gender] in VALUES(tblGender[Gender]) ||
        tblData[Age] in VALUES(tblAge[AgeGroups])) 
    )
)
3 ACCEPTED SOLUTIONS
Deku
Super User
Super User

Need a all() to remove the current filter context

 

SelectedEmployees =

CALCULATE(

    COUNTROWS(tblData),

    FILTER(

       All( 'tblData' ),

        (tblData[Location] in VALUES(tbLocations[Locations]) ||

        tblData[Gender] in VALUES(tblGender[Gender]) ||

        tblData[Age] in VALUES(tblAge[AgeGroups])) 

    )

)


Did I answer your question?
Please help by clicking the thumbs up button and mark my post as a solution!

View solution in original post

ThxAlot
Super User
Super User

Make sure these 3 tables tbLocations, tblGender, tblAge DON'T filter each other. If so, the measure is fairly simple,



Expertise = List.Accumulate(


        {Days as from Today},


        {Skills and Knowledge},


        (Current, Everyday) => Current & Day.LearnAndPractise(Everyday)


)



View solution in original post

SelectedEmployees = 
CALCULATE(
    COUNTROWS(tblData),
        ALL('tbLocations'),ALL(tblGender), ALL(tblAge),
        OR(OR(tblData[Location] in VALUES(tbLocations[Locations]),
                tblData[Gender] in VALUES(tblGender[Gender])), 
            tblData[Age] in VALUES(tblAge[AgeGroups]))   
)

View solution in original post

6 REPLIES 6
v-kathullac
Community Support
Community Support

Hi @Kosh  ,

 

As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided for the issue worked? or Let us know if you need any further assistance?
If our response addressed, please mark it as Accept as solution and click Yes if you found it helpful.


Regards,

Chaithanya.

v-kathullac
Community Support
Community Support

Hi @Kosh  ,

 

As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided for the issue worked? or Let us know if you need any further assistance?
If our response addressed, please mark it as Accept as solution and click Yes if you found it helpful.


Regards,

Chaithanya.

ThxAlot
Super User
Super User

Make sure these 3 tables tbLocations, tblGender, tblAge DON'T filter each other. If so, the measure is fairly simple,



Expertise = List.Accumulate(


        {Days as from Today},


        {Skills and Knowledge},


        (Current, Everyday) => Current & Day.LearnAndPractise(Everyday)


)



Deku
Super User
Super User

Need a all() to remove the current filter context

 

SelectedEmployees =

CALCULATE(

    COUNTROWS(tblData),

    FILTER(

       All( 'tblData' ),

        (tblData[Location] in VALUES(tbLocations[Locations]) ||

        tblData[Gender] in VALUES(tblGender[Gender]) ||

        tblData[Age] in VALUES(tblAge[AgeGroups])) 

    )

)


Did I answer your question?
Please help by clicking the thumbs up button and mark my post as a solution!
Kosh
Frequent Visitor

Thanks for the reply. How to show this data in a table/matrix with breadkdown by any field? Using ALL in filter is giving same value for all rows table/matrix.

SelectedEmployees = 
CALCULATE(
    COUNTROWS(tblData),
        ALL('tbLocations'),ALL(tblGender), ALL(tblAge),
        OR(OR(tblData[Location] in VALUES(tbLocations[Locations]),
                tblData[Gender] in VALUES(tblGender[Gender])), 
            tblData[Age] in VALUES(tblAge[AgeGroups]))   
)

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

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.