Forum Discussion

j1s's avatar
j1s
Helper I
2 years ago
Solved

Button to toggle visual axis Count vs Count (Distinct)

Is there a way to add a button to a visual page to make the axes for the visuals on the page (stacked bars in my case) switch between Count and Distinct Count?

 

 

  • j1s Yes, you can create 2 visuals and 2 buttons and stack them. Create 2 bookmarks using the Bookmarks pane along with the Selection pane to toggle between the visuals and buttons. Tie these bookmarks to the buttons.

3 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi j1s

     

    Greg_Deckler Thank you for sharing!

     

    Yes, you can achieve your goals by creating bookmarks and buttons.

     

    Here are the details, please try:

     

     First, you need to create two versions of your stacked bar visual - one using Count and the other using Distinct Count. Ensure these are placed exactly on top of each other on your report page.

     

    Next, create two bookmarks in Power BI - one for each visual state (Count and Distinct Count). Make sure to hide one visual and show the other for each bookmark accordingly.

     

     

    Finally, insert a button on your report page that users can click to toggle between the two bookmarks (and thus, between Count and Distinct Count).

     

     

     

     

    By following these steps, you'll effectively create a toggle mechanism on your report page, allowing users to switch the visual's axis between Count and Distinct Count with a simple click.

     

    You can view the link below for more details:

     

    Create report bookmarks in Power BI to share insights and build stories - Power BI | Microsoft Learn

     

    Create buttons in Power BI reports - Power BI | Microsoft Learn

     

    Regards, 

    Nono Chen 

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

     

    • j1s's avatar
      j1s
      Helper I

      Thanks, any reason you're not advocating using the bookmark navigator button option, rather than creating and configuring normal buttons?

  • Greg_Deckler's avatar
    Greg_Deckler
    Community Champion

    j1s Yes, you can create 2 visuals and 2 buttons and stack them. Create 2 bookmarks using the Bookmarks pane along with the Selection pane to toggle between the visuals and buttons. Tie these bookmarks to the buttons.