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
quikin5
Frequent Visitor

Exclude a visual from a certain value in slicer

Hi,

 

I have a slicer and a clustered bar chart affected by this slicer. The slicer affects the bar chart axis.

Suppose the slicer has three items (and thus the bar chart has three bars).

 

I want to exclude the bar chart from the slicer JUST for a certain item of the slicer. This is, when selecting this item in the slicer, the bar chart should look as if I were not selecting any item.

1 ACCEPTED SOLUTION

Hi  @quikin5 ,

 

Create a measure as below:

Measure = 
var _tab=EXCEPT(ALL('Table'),ALL('Table (2)'[State]))
Return
IF(MAX('Table (2)'[State]) in FILTERS('Table'[Name]),CALCULATE(SUM('Table (2)'[Score])),
IF(MAX('Table'[Name]) in _tab,CALCULATE(SUM('Table (2)'[Score]),FILTER(ALL('Table (2)'),'Table (2)'[State]=MAX('Table (2)'[State])))))

And you will see:

vkellymsft_0-1626421747590.pngvkellymsft_1-1626421755061.png

For the related .pbix file,pls see attached.

 

 

Best Regards,
Kelly

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

View solution in original post

4 REPLIES 4
quikin5
Frequent Visitor

@selimovd Thanks for your reply! Maybe a little example could help. Suppose I have two tables. Table 1 consists of 1 column with the name of U.S. states and "United States" (51 rows). Table 2 consists of three columns, the first is a student id, the second the state, and the third is a test score. Use Table 2 to graph the average test score by state on a bar chart and use Table 1 to create a slicer that filters by state. If you select "United States" in the slicer, then the bar chart would look blank (since Table 2 only contains states), and I don't want that to happen. Instead, what I want is that when I select "United States", the chart looks as if nothing is selected in the slicer. 

Hi  @quikin5 ,

 

Create a measure as below:

Measure = 
var _tab=EXCEPT(ALL('Table'),ALL('Table (2)'[State]))
Return
IF(MAX('Table (2)'[State]) in FILTERS('Table'[Name]),CALCULATE(SUM('Table (2)'[Score])),
IF(MAX('Table'[Name]) in _tab,CALCULATE(SUM('Table (2)'[Score]),FILTER(ALL('Table (2)'),'Table (2)'[State]=MAX('Table (2)'[State])))))

And you will see:

vkellymsft_0-1626421747590.pngvkellymsft_1-1626421755061.png

For the related .pbix file,pls see attached.

 

 

Best Regards,
Kelly

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

Hey @quikin5 ,

 

if you give me a few tables or a data set or an example, I can help you with the solution.

 

Best regards

Denis

selimovd
Super User
Super User

Hey @quikin5 ,

 

you have to handle that in the DAX measure.

There you can check for that combination and if that happens you should return all values, otherwise just the combination the slicer has.

 

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
 
Best regards
Denis
 

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.