Ravindra BagaleCourses & study guides Track your progress

Labs · Power BI

Lab: Make a Chart/Table Toggle with Bookmarks, the Selection Pane and Buttons

Intermediate30 minPower BI Desktop (free) · Your Lab 18 file

Course: Power BI · Chapter 19: Bookmarks, Selection Pane, Buttons and Navigation

Chapter 19 covers bookmarks, the Selection pane, buttons and navigation; this lab combines all four into one toggle.

Download pbi_sales.csv (24 orders) Download pbi_cities.csv

Chala mitrano! Some people love charts, some want exact numbers in a table. Instead of giving both and wasting half the page, we give one space and two buttons: Chart and Table. It feels like a real app. The secret is three tools working together: Selection pane, Bookmarks and Buttons. Ek jaaga, don roop!

Suppose we are…

Suppose the Croma report page is crowded. The sales director likes the city bar chart; the finance team insists on the table with exact numbers. Both visuals take half the page each. We will put them in the same spot, show one at a time, and let the user switch with two buttons, while any slicer choice (for example Product = Laptop) stays as it is. The numbers are sample data made up for practice.

Goal of this lab

By the end you will have:

  • A bar chart and a table of Sales by City stacked in one place.
  • Two bookmarks, Show Chart and Show Table, with Data turned off.
  • Two buttons, Chart and Table, that switch between them and keep the slicer selection.

What you need (all free)

The data: before and after

Before. Two visuals showing the same thing, each eating half the page.

Before: a bar chart and a table of Sales by City both visible, each using half the page

After. Two bookmarks and two buttons share one space.

After: bookmark Show Chart has the bar chart visible and table hidden; Show Table has the table visible and chart hidden; Data option off in both; buttons Chart and Table

The formula

No DAX. A bookmark is a saved snapshot of the page. You choose what it remembers:

Bookmark option What it remembers For our toggle
Data Filters, slicer choices, sort order, drill level Off, so the user's Laptop choice is not reset
Display Which visuals are visible or hidden (Selection pane) On: this is the whole toggle
Current page Which page to open On

A button with Action → Bookmark simply applies a bookmark when it is clicked.

Steps

  1. Open your Lab 18 file, Save as Lab-19-bookmarks, and add a new page called Toggle.
  2. Add a Clustered bar chart (pbi_cities[City], Total Sales) and a Table (City, Total Sales). Give both the same size and position: select each one and set Format → General → Properties → Size and position to the same numbers, for example X 40, Y 120, Width 600, Height 400.
  3. Add a Slicer with pbi_products[Product] on the left of the page.
  4. Click View → Selection and View → Bookmarks. Two panes open on the right.
  5. In the Selection pane, double-click each visual name and rename them City chart, City table and Product slicer.

    What you should see: three names with an eye icon next to each.

  6. Click the eye next to City table to hide it. In the Bookmarks pane click Add, then double-click the new bookmark and rename it Show Chart.

  7. Click the … next to Show Chart and untick Data. Keep Display and Current page ticked.
  8. Now show City table (eye on) and hide City chart (eye off). Add a bookmark, rename it Show Table and untick Data too.
  9. Click Insert → Buttons → Blank. In Format button → Button → Style → Text type Chart. Under Action, switch it on, set Type to Bookmark and Bookmark to Show Chart.
  10. Make a second button Table with Action → Bookmark → Show Table. Place both buttons above the visual.
  11. Test: Ctrl+click the Chart button, then the Table button.

    What you should see: the chart and the table swap in the same place.

  12. In the slicer, click Laptop. Ctrl+click Table, then Chart.

    What you should see: both views keep Laptop: Mumbai 250K, Pune 200K, Nagpur 150K, Nashik 150K. The slicer is not reset, because Data is off.

  13. Clear the slicer, click Show Chart in the Bookmarks pane so the page opens with the chart, and save.

Ravindra Bagale's Tip

The number one bookmark bug: you update a visual, but the bookmark still remembers the old state. After changing visibility, right-click the bookmark → Update. And always name things in the Selection pane; "Clustered bar chart 3" is impossible to find later. Naav dya, update kara!

Common mistakes

Mistake What happens Fix
Data left on in the bookmarks Clicking a button resets the slicer to what it was when you saved Untick Data for toggle bookmarks
Hiding visuals after adding the bookmark The bookmark saved the wrong state Set visibility first, then Add, or right-click → Update
Clicking buttons without Ctrl in Desktop The button is selected for editing instead Ctrl+click in Desktop
Visuals not exactly on top of each other The page "jumps" when you toggle Same X, Y, Width, Height in Size and position
Bookmark saved with Selected visuals only Only part of the state applies Leave All visuals unless you know why

Self-check checklist

0 of 4 done

Try-at-home challenge

Make the active button look "pressed": when the chart is shown, the Chart button should be dark and the Table button light, and the other way round. Hint: you need two copies of each button and the Selection pane.

Check your answer

Make four buttons: Chart (dark), Chart (light), Table (dark), Table (light). Place the dark and light copies of each button exactly on top of each other. In the Show Chart state, show Chart (dark) and Table (light) and hide the other two; right-click Show Chart → Update. In Show Table, show Table (dark) and Chart (light); Update. Give the light buttons the bookmark actions. Now the dark button always marks the current view.

Samjla ka? Selection pane hides and shows, bookmarks remember it (Data off), buttons apply it. Aata pudhe jaauya: colour bars red or green with DAX and write a dynamic title.