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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
HassanAshas
Helper V
Helper V

Problem in Displaying/Hiding Visual based upon a Slicer value, using Measure

I have a problem where I have to hide a visual and show another visual based upon Slicer Selection. I followed this tutorial: https://exceleratorbi.com.au/show-or-hide-a-power-bi-visual-based-on-selection/#:~:text=Click%20on%2...

 

My problem is, 

  1. I have a slicer for Capacity.
  2. If a user Selects "All" Capacity, then it should show a Bar Graph with Capacity on X-Axis
  3. If a user selects any particular capacity, then the bar graph shown should have Operation on X-axis

To solve this issue, I created two Bar Graphs. I created a Measure that checks whether capacity is filtered or not, 

 

 

Is Capacity Selected = 
    IF(
        ISFILTERED('Main Sheet'[Capacity]), 
        1, 
        2
    )

 

 

And added this to both Graph Visual Filters. 

 

The problem I am facing is when I select 2, the Bar Graph with Operation at X-Axis disappears (as expected), but the bar graph with Capacity at X-Axis does not show. I also added a card to check the value of Measure and it's also 2, which means that the bar graph with Capacity at X-Axis should show when I select "All" from the Capacity Filter. 

 

Even more interestingly, if I change the X-Axis to any attribute other than Capacity, then this bar graph works totally fine. 

 

Can anyone help me out in this? How can I show the Visual of Bar Graph containing Capacity at X-Axis, whenever "All" is selected from Capacity Slicer.

 

Here's the Power BI Workbook that you can download and use: https://drive.google.com/file/d/1T8YAYZ8spOLKlA9HLE1coN17mnDyTA1w/view?usp=sharing

 

I also uploaded a small video on Youtube showing the expected behavior of what I am doing and where is it causing the problem, 

https://youtu.be/1-teUkPKZ8Q

As you can see, when using BillingPool (any attribute other than Capacity), I get the expected Results. But as soon as I select Capacity on X-Axis, the same behavior doesn't happen. 

 

 

1 ACCEPTED SOLUTION
v-jianboli-msft
Community Support
Community Support

Hi @HassanAshas ,

 

It seems that you have already applied a filter to Capacity before:

vjianbolimsft_1-1670831307354.png

As a result the measure will not work in the correct way, please check and modified it.

 

Best Regards,

Jianbo Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

3 REPLIES 3
v-jianboli-msft
Community Support
Community Support

Hi @HassanAshas ,

 

It seems that you have already applied a filter to Capacity before:

vjianbolimsft_1-1670831307354.png

As a result the measure will not work in the correct way, please check and modified it.

 

Best Regards,

Jianbo Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

amitchandak
Super User
Super User

@HassanAshas , changing the axis based on the slicer value is not possible other than field parameters.

In this case you have to think about bookmarks and buttons

 

Bookmarks
https://radacad.com/bookmarks-and-buttons-making-power-bi-charts-even-more-interactive
https://docs.microsoft.com/en-us/power-bi/desktop-bookmarks

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Hi @amitchandak, I am not changing the Axis of the Bar Graph, I am using two Bar Graphs and I am making one graph 100% Transparent when a Slicer Value is selected (using a Measure) 

 

I have uploaded a small Video on what I am doing: 

 

https://youtu.be/1-teUkPKZ8Q

As you can see, when using BillingPool (any attribute other than Capacity), I get the expected Results. But as soon as I select Capacity on X-Axis, the same behavior doesn't happen. 

 

 

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!

December 2024

A Year in Review - December 2024

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