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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Pragati11

Toggle Between Charts in Power BI

Let us consider a scenario where we need to represent similar information at two different category levels.

One potential and easiest way would be to create 2 charts or 2 visuals representing same metric at different levels. Like the one shown below:

image1.png

In the above charts, I am displaying total transaction value by Region and by Attribute on 2 different charts.

Now suppose on the reporting tab, I have multiple visuals and I do not have enough space for these 2 charts. What should I do in such scenario, where client requirement still stands at having 2 separate charts?

 

Here we start to talk about Bookmarks and how we can use them to toggle or switch between 2 charts.

 

Let us start by creating 2 buttons in Power BI. Go to Insert --> Buttons --> Blank

image2.png

I am using blank buttons for now. We can change the text or label for the button as shown below:

image3.png

 

Similarly, I created a second button for Attribute:

image4.png

 

Now starts our real work.

Go to View option on the top ribbon and click on Bookmarks. You will see a bookmarks pane on the right as highlighted below:

image5.png

 

Now we will create 2 bookmarks for the 2 buttons that we have got.

Under Bookmarks Pane, click Add and you can create bookmarks. Following link can be referred for bookmarks creation: https://docs.microsoft.com/en-us/power-bi/create-reports/desktop-bookmarks

 

Once we create the bookmarks, we get the following as shown below:

image6.png

 

Go to the top ribbon again: View --> Selection

image7.png

 

We get a Selection pane on the right. If you see in this section, we have got all the visuals and buttons that we have created so far on our reporting tab. For ore details on Selection Pane, refer following link: https://www.c-sharpcorner.com/article/new-power-bi-featu-selection-pane-in-power-bi-preview-feature/

 

Now we will define actions for the buttons. The screesnhot shown below is for the Region button: (Do the same for the Attribute button)

image8.png

 

Now we need to achieve following things:

  1. When I click on Region button, following actions should take place:
    • Transaction Value by Region chart
    • Attribute button (this will help us in switching to Attribute based chart)
    • HIDE Transaction Value by Attribute chart
    • HIDE Region button
  2. When I click on Attribute button, following actions should take place:
    • Transaction Value by Attribute chart
    • Region button
    • HIDE Transaction Value by Region chart
    • HIDE Attribute button

Now go to Selection Pane on the right --> Hide Attribute button, Hide Transaction Value by Region chart; under Bookmarks Pane UPDATE the Attribute button.

 

We are basically creating an action for the Attribute button here. When this button is clicked, it should show us Transaction by Attribute chart and Region button, so that we have an option to switch back to Regional chart.

image9.png

 

Similarly, we do the same settings for the Region button as shown below:

image10.png

 

Now let us see how this is working in the report view. (Use Ctrl+Click in Power BI Desktop to click on a button)

toggle1opt.gif

 

Just to clean the visualisations, rather than having them side by side, let us place them in such a way that they are above each-other and completely cover each other up.

  1. Transaction Value by Attribute chart and Region button should be together.
  2. Transaction Value by Region chart and Attribute button should be together.

Just see the below image to make this clear – how I am trying to place these visuals and buttons on the top of each-other. This is in a way just taking up space for one single visual but in reality having 2 charts:

image11.png

 

Now completely laying them over one another, I get the following:

image12.png

 

  • Region button is placed below Attribute button
  • Transaction by Attribute chart is placed below Transaction by Region chart

Now let us see the completed functionality in a single frame:

gifcording-1599145805981.gif

 

So, when we click on Region button, we see chart related to region and Attribute button.

In case we need to switch back to Attribute related chart, same works for the Attribute button as well.

 

This is how we can toggle/switch between charts in Power BI, using Bookmarks and Buttons functionality.

Hopefully, this article helps everyone out there.

 

Pragati

Comments

@Pragati11 - Great step-by-step walkthrough of a very common thing that people want to do and can be really confusing the first time you go through it. Great tutorial on how to get it done!

@Greg_Deckler Thanks Greg. I am happy that this simple and short article seems useful.

I will keep on posting more similar tips and tricks.

Many thanks, very useful.

Thank you for posting this.  I had to refresh myself on bookmarks and selection pane and was still easy to follow and I was able to get it working.

Thanks @Pragati11!

 

I have some slicers on the page, which rest every time I toggle between the bookmarks. Do you know to prevent this?

Hi @JoeMorecroft,

 

If you have got slicers on your report page along with bookmarks and you don't want them to reset once the bookmark is selected, make sure you use the Selected Visuals setting while updating the bookmark as shown below:

Pragati11_0-1658335018159.png