Pagination is a great way to improve the user experience and minimize the footprints that tables occupy within Tableau dashboards. In cases, where we need to show multiple records or our tables are too long to display it in single view, pagination comes to rescue.
By implementing this technique, users will be able to “turn the page” to another set of rows. However, setting it in a way to make it dynamic can be tricky!!
Let’s dive in and unfold the leash!
Data:
Sample Superstore Data
Load Orders Data Source
Parameter:
We need to create a Parameter for “Page Size”:
Steps:
- Set Name to Page Size
- Set Data Type as Integer
- Set Current Value to 20
- Set Allowable Values to Range
- Set Minimum to 5
- Set Maximum to 20
- Set Step Size to 5
Something like this:
Calculated Fields:
To keep a count on current Page Number:
INDEX
INDEX ()-1
Page Number
INT([Index]/ [Page Size]) +1
Worksheet:
We now build our Worksheet:
- Change Mark Type to Text
- Drag Order ID onto the Rows Shelf
- Drag Order Date onto the Rows Shelf
- Right Click on this pill, select Exact Date and convert to Discrete
- Drag Customer Name onto Rows Shelf
- Drag Customer ID onto Rows Shelf
- Now double click on Sales, Quantity and Profit.
We now see the following:
Now, we add pagination:
- Drag Page Number onto the Rows Shelf
- Right Click on this pill and convert to Discrete
- Drag this pill on the Filters Shelf and select 1
Note: “Page Number” is renamed to “Page” using Edit Title
We now see the following:
Dashboard:
Now we move to our final step – Visualization.
Using proper Objects and Alignments we pull our worksheet onto the Tableau Dashboard.
Voila!! We can control the Page Size using the parameter and select the Page Number using the filter in Tableau.