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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
johnyip
Super User
Super User

Count the number of items in a slicer

How do I count how many items are available (not how many items I have selected) in a slicer? I need to store it in a variable or measure, so that I can use the value for future use.

 

Update:

My slicer is something like Market_Slicer in this file:
https://drive.google.com/file/d/1SWSzCKiwckuAr2woo_LeTi2GecsnWlPF/view?usp=sharing

The total number of items varies, depending on choices of another slicer (Company_Slicer).



Please mark my post as the solution if this answers your question!
Appreciate your Kudos !!
1 ACCEPTED SOLUTION
johnyip
Super User
Super User

I managed to find another workaround recently, it is to use ISFILTERED(). I can avoid all the messy variables by using it.

 

Thanks for all the replies.



Please mark my post as the solution if this answers your question!
Appreciate your Kudos !!

View solution in original post

3 REPLIES 3
johnyip
Super User
Super User

I managed to find another workaround recently, it is to use ISFILTERED(). I can avoid all the messy variables by using it.

 

Thanks for all the replies.



Please mark my post as the solution if this answers your question!
Appreciate your Kudos !!
PaulDBrown
Community Champion
Community Champion

Ok, try:

Avaailable =
VAR _All = CALCULATE (DISTINCTCOUNT (Fact table [Slicer field]), ALL(Fact table ))

RETURN

_All - DISTINCTCOUNT(Fact Table[Slicer field] )





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






PaulDBrown
Community Champion
Community Champion

Try:

available = IF(ISFILTERED ( Table slicer), COUNTROWS (ALL(Table Slicer)) - COUNTROWS (VALUES(Table Slicer [Column])), COUNTROWS (ALL(Table slicer)))





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Helpful resources

Announcements
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.