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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
bvy
Helper V
Helper V

Count selected slicer values -- BUT exclude two explicit entries

Hello I have a slicer with values A, B, C, D and E (for example). I need DAX to return the number of items selected -- BUT exclude A and/or B from the count if they're selected. 

 

So I can use this to get the count of selected values, but not sure where to filter out (ignore) A and B from the count. 

 

_count = IF(ISFILTERED(Slicer[ABCDE]), COUNTROWS(VALUES(Slicer[ABCDE])))

 

Thanks, 

1 ACCEPTED SOLUTION

Thank you. This seemed to work as well. 
COUNTX(FILTER(ALLSELECTED(Table[Option]), NOT Table[Option] IN {"A", "B"}), Table[Option])

View solution in original post

4 REPLIES 4
danextian
Super User
Super User

Hi @bvy ,

 

Assuming there is an existing relationship between the slicer table and table being counted, try something like below:

count =
CALCULATE (
    COUNTROWS ( Table[Column] ),
    FILTER ( Slicer, NOT VALUES ( Slicer[Value] ) IN { "A", "B" } )
)

 










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


Proud to be a Super User!









"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Thank you but nothing about that seems to work. For example, COUNTROWS() takes a table as an argument, not a column. The FILTER seems to ignore selected values.

 

Everything is in one table currently. 

 

Anyone else? 

Hello, Please try this:

Value without A and B = 
CALCULATE (
    COUNTROWS ( 'Table' ),
    FILTER ( Slicer, Slicer[Column] <> "A" && Slicer[Column] <> "B" )
)

danextian_1-1660486210300.png

 










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


Proud to be a Super User!









"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Thank you. This seemed to work as well. 
COUNTX(FILTER(ALLSELECTED(Table[Option]), NOT Table[Option] IN {"A", "B"}), Table[Option])

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.