12 March, 2021
Tableau Hacks: How to switch two views in the same dashboard container?
Surely you are wondering how you can show one view or another interactively. Not all views show information at all times and we don’t want to have empty views with zero interest. There are other options, yes, such as what is dynamic is the field itself, which carries in the calculation itself a condition that returns one or another variable; but, that only works in certain cases in which the views are of the same type and share all the other variables, for all the others, it is best to create both views separately and then alternate them as explained in this blog.
For this we are going to use a parameter. We started doing click in the little arrow in the upper right corner of the Data Panel> Create Parameter and we create one that alternates the values between 1 and 2 and displays them as we want (because we are going to have two alternative views, if there are more, we would also have to increase the list of values for the parameter).
Then we create a calculated field that refers to that parameter and equates it to one of the alternative values (we will put 1, as it is the first):
We dragged it to the filter box. In the first of the sheets, let’s call it Sheet 1, we will show CC 1? = True, and, on Sheet 2, False. Thus, we make sure that when one of them has information, the other remains blank. Now, not only do we want one of them to go blank, we want hides. Bad news: you can’t to disappear leaves. The good news is that it is possible that, by remaining empty, they reduce so much in size that, in practice, it is almost as if they disappeared.
For this, it is important to make sure that they are inside the same container in the dashboard, that is to say, at the same level. We must also specify “Entire View” for both views, so that they expand or contract in their entirety depending on what they are showing at all times.
Finally, we show the parameter (ATTENTION: the parameter, not the filter. Many times we make the mistake of interacting directly with the filter and that can lead to a malfunction) and we place it in a visible place in the dashboard.
Other practices that you should keep in mind are: hide the titles, otherwise Tableau will never consider that the view is empty; do not set the width or height of the sheet or it will not resize correctly; and do not check the option of Uniformly Distributed in the options menu of the container that encompasses them.
If you have followed all the steps well, you already have your dashboard that substitutes one view for another according to the selected parameter at all times.