21. Dynamic Charts: Field Parameters, What-if and Dynamic Top N
21.6 Chart/Table Toggle (Recap)
Start with a problem
Ravina asks for the chart/table switch again on the parameters page.
Explain simply
The bookmark toggle (Module 19.4) works on any page: same fields in both visuals, Data off, Selected visuals.
Show the data
| City | Total Sales (₹) |
|---|---|
| Pune | 850 |
| Nashik | 800 |
| Kolhapur | 450 |
| Total | 2,100 |
About this data: This table uses columns: City, Total Sales (₹). This table uses columns: View, Pune, Nashik, Kolhapur. This table uses columns: Wrong result, Reason, Correction. Values shown are the lesson examples already on this page (not a new dataset).
Fictional sample data. Practice file: visuals_orders_apr_may_2026.csv (source: src/practice/).
Demonstrate
- Duplicate the chart; convert the copy to a table.
- Stack them; create Chart view and Table view bookmarks (Data off, Selected visuals).
- Add two buttons calling the bookmarks.
- Pick Total Orders in the Metric parameter; toggle.
Show the result
Your result should look like this (fictional sample):
| View | Pune | Nashik | Kolhapur |
|---|---|---|---|
| Chart (Total Orders) | 3 | 3 | 2 |
| Table (Total Orders) | 3 | 3 | 2 |
Explain what happened
Both visuals use the field parameter, so the metric choice applies to both; the bookmark only switches visibility.
Explore further
- Test the toggle with every metric.
Detailed reference for this lesson:
A classic dynamic-chart pattern is two visuals in the same place, shown/hidden with bookmarks and buttons. Module 19.4 has the full steps. Combine it with field parameters: the chart and the table both use Metric Selector, so one slicer drives both views.
Practice task
Look: build a "Dynamic Explorer" page: a Metric Selector (Sales, Orders, AOV, Avg Delivery), an Axis Selector (City, Category, Payment Mode, Order Hour), a Top N slider for the bar chart, a what-if slider for Target Delivery Minutes with % Orders Under Target, and a chart/table toggle. Add a dynamic title that names the metric and axis chosen.
Ravindra Bagale's Tip
Friends, many students keep both the chart and the table visible behind each other, which slows the page because both still run queries. Hidden visuals don't run queries, so make sure the bookmark actually hides one of them. Never forget this.
Ravindra Bagale's Tip – मराठी
मित्रांनो, बरेच students chart आणि table दोन्ही एकमेकांच्या मागे visible ठेवतात, त्यामुळे page slow होतं कारण दोन्ही queries चालवतच राहतात. Hidden visuals queries चालवत नाहीत, म्हणून bookmark त्यातला एक खरंच hide करतो याची खात्री करा. हे अजिबात विसरू नका.
Ravindra Bagale's Tip – हिंदी
दोस्तों, बहुत से students chart और table दोनों को एक-दूसरे के पीछे visible रखते हैं, जिससे page slow होता है क्योंकि दोनों queries चलाते रहते हैं. Hidden visuals queries नहीं चलाते, इसलिए पक्का करो कि bookmark सच में उनमें से एक को hide करे. यह बिल्कुल मत भूलना.
Fix common mistakes
| Wrong result | Reason | Correction |
|---|---|---|
| Table shows Total Sales while chart shows Orders | Table uses a fixed measure | Use the parameter field in both |
| Metric slicer reset by toggle | Data On | Data Off |
| Buttons overlap visuals | Layout | Reserve a toolbar area |
Practise independently
Practice task
With Avg Delivery Mins selected, what does the table show for Kolhapur?
Hints
- Delivered only.
Solution
7.0.
Think like a professional
Reusing a tested pattern saves time and keeps the report consistent.
Revision card