The Need for Scrolling
As a data viz consultant, I encounter situations regularly where a client’s wishes, or their data, doesn’t fit neatly into the specified dashboard size. This means, inevitably, I need to introduce scrolling, which I venomently hate on a dashboard. This becomes even worse when you have multiple sheets that tie back to a single header field.
Here’s a terribly messy example (because that’s what they end up looking like):
Now, even after hiding the headers, you have three separate worksheets that do not scroll together. What. A. Pain. Also, not a positive user experience.
So, what’s the solution? Well, parameter actions may be able to help – at least some of the time. The disclaimer is, that with some complicated builds or filters, using the INDEX() calc (which this solution uses) may not be effective. However, this does work for scrolling through a single sheet as well as multiple sheets given the steps I’ve done below.
Setting Up Calcs
The basic premise of this concept is that we set up a parameter value and a subsequent calculation that will return only a specified number of rows based on the INDEX() calculation.
Step 1 | Index
Create a calculation called “Index”. The INDEX() calculation is Tableau’s way of numbering each row in the partition. This means that however you sort the view, the Index value for 1 will be the first row in the table.
Step 2 | Scroll Parameter
Create a parameter called “Scroll” with a data type as float and all allowable values. Unfortunately, you can’t use the Index field to “Add from Field”. But, this shouldn’t be too much of a problem since our parameter will be an action based on the total rows in our (later created) scroll worksheet. So, no worries, my friend.
Step 3 | Show Rows
Next, we need to create a calculation that will only show the rows within a certain range of the parameter value.
The “Show Rows” calculation will show (in this case I’ve selected) 25 rows based on the index value. So if the index value is 25, we will show rows 1-25. If it’s set to 40, only rows 15-40 will populate. Because the first 25 rows shouldn’t move until the parameter goes past 25 and I want 25 rows to show even if you are scrolling on row 5, I set the calculation to basically do nothing until you scroll past the 25th mark, hence the first part of the calculated statement below.
Step 4 | Build the Table or Graph
Build your table or view with the necessary headers and charts you need. If you are building more than one chart that need to scroll together then be sure to have the same headers, so that you have the exact same number of rows in both (or all) worksheets you will put on your dashboard.
Here’s how my first table looked:
While you don’t have to, I added the Index calculation to my table so that the viewer could see the scrolling numbers. However, you don’t need it as a header at all. As long as it’s on the detail shelf you are golden. Make sure you have the Index field set to “compute using table down” since we want the numbers to just count down the rows of our table.
Step 5 | Scroll Indicator on Table
Because sometimes people can scroll faster than then intend to, or the delay is a little glitchy, I added a scroll indicator so that the viewer could see if they actually scrolled further than intended. Sometimes it’s hard to follow the numbers, so the color is easy to pick out in the movement (side note: pre-attentive attributes, folks). The calculation renders true when the value is divisible by 25. I chose this because I set my table to be 25 rows high. You can change this depending on how many rows you want to show in your dashboard. The result is the little circle you see move up and down as you scroll (see image above).
Step 6 | Create the Scroll Bar
The scroll bar is what will (eventually) will drive our parameter action from. The main objective is just to set up a set of marks that has the same number of rows as the main table (or graph) we want to scroll. If our table has 200 rows, we need the scroll bar to have 200 rows so that the parameter will connect one with the other.
This means you need to create the same number of marks on the scroll bar sheet as the main table/graph sheet. (Note, that once you put the “Show Rows” calc on the filter, you will obviously only have the number of marks you specified.)
The tricky part here is to ensure all the fields on your main table/graph are on your level of detail shelf so that your marks match up. Then set your Index calc to compute using all of those partitioning fields.
Step 7 | Scroll Indicator on Scroll Bar
To add the color to show where your user is scrolling, simply create a calculation that is true when the value of the Index equals the value of the parameter and put that on the color shelf (see above).
Step 8 | Hook Up the Dashboard
The last step is to create a dashboard, set the filter, and hook up the parameter. First, put the “Show Rows” calculation on your worksheet so that only the designated rows determined by the parameter value show up. Next, create your dashboard and set up your table/graph and your scroll bar worksheets side by side. Set both to view “Entire View”.
Next, create your parameter action. Go to Dashboard — Actions… and “Add Action”.
You will want to have this run when the user interacts with the Scroll Bar worksheet on hover. with the target parameter of the “Scroll” parameter. The field is INDEX().
This should be the result:
Or this with the multiple charts (pardon my shotty video capture, but you get the point).
Hopefully, that is helpful. However, I’m aware sometimes directions are only as clear as the one who is describing them and I won’t admit to always be the clearest individual on the planet.
As always, feel free to reach out on Twitter or email if you have questions or other ideas related to this idea!
Link to the dashboard, which you can download, can be found here.