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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Igor_Reis_HG
Regular Visitor

Add count of values in a slicer visual

I have managed to create a slicer visual that not only shows the unique values of a column I want to filter but also the amount of times these values appear in the column, as shown in the picture below.

 

Igor_Reis_HG_0-1698079633067.png

 

But I'm having an issue where the value inside the parenthesis doesn't change when I filter the page with a slicer with date values.

When filtering the page with the month of september it should only show the amount of each value for that month.

 

To be able to reach the slicer visual above I:

- Manually inserted the unique values of the column I want to use for the slicer, using insert data from within Power Query

- Created a calculated column with the following DAX code:


´´´

ConcatenatedValue =
VAR ValueFromNewTable = 'New Table'[Status]
VAR CountOccurrences =
    CALCULATE(
      COUNTROWS('Original Table'),
      DISTINCT('Original Table'[Status]),
      'Original Table'[Status] = ValueFromNewTable
    )
RETURN
    ValueFromNewTable & " (" & CountOccurrences & ")"

´´´

- Created a blank slicer and inserted the calculated column that I created in it.

1 ACCEPTED SOLUTION
vicky_
Super User
Super User

I don't think this feature is doable with PowerBI's existing slicer. The reason that the values won't change is that calculated columns and tables only change when the report is refreshed. But at the same time, we can't use measures in slicers. 

As a work around, you could try use a table / matrix with the status and measure for countOccurences, and turning on visual interactions for cross-filtering. 

View solution in original post

3 REPLIES 3
vicky_
Super User
Super User

I don't think this feature is doable with PowerBI's existing slicer. The reason that the values won't change is that calculated columns and tables only change when the report is refreshed. But at the same time, we can't use measures in slicers. 

As a work around, you could try use a table / matrix with the status and measure for countOccurences, and turning on visual interactions for cross-filtering. 

Hi @vicky_ san and @Igor_Reis_HG San,

It is do able with new slicers visual in Power BI .Version: 2.126.927.0 64-bit (February, 2024).

I have attached the snippet of my dashboard.

In new slicers visual, we need to add field values for labels and they are interactive and dynamic.

PRANESHBALAJI_0-1709402064706.png

 

Thanks for sharing @PRANESHBALAJI . Quick question for you, what visualization are you using to create the box and whisker plot? Ive search a lot to try to find one and havent beena able to find a good one. It would be great if you could share the link. Thanks!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.