For day five of #CloudstreamChristmas Five Parameters!
Our Favourite use of a parameter by far, most used when we have to keep things simple and uncluttered but need to present some wildly different views of the data the sheet selector parameter makes use of layout containers and filters to create a page where there are multiple views but only one visible view at a time.
Step one is to create the parameter, for this use we like to keep things simple and just use a string parameter:
Now we put the three sheets in question onto a dashboard, we place them using a horizontal layout container, this is so when we hide the two we are not interested in the remaining one takes up a predictable amount of space:
We also take care to hide the titles otherwise the views in question will not shrink away to nothing when unselected.
Now we need to create the mechanism behind the selector, we do this by placing the parameter on the filter shelf, however, we cannot do this directly so we use the above calculation to do this.
For each sheet we first select the corresponding parameter value, then we place the calculation we created above on the filter shelf, then we select the one visible check box that corresponds to our parameter value. We repeat this for all our sheets.
And that's the basics of how to use a parameter to switch sheets.
Our next favourite usage of the parameter tool is related to the ones we see above, here though we use the switching function to change the measure we are using, again useful of the client wants to see the same graph with a different metric.
Step one, create the parameter:
Step 2, Create the Calculation;
Step 3, use;
This is much simpler, one feature of some reports that we have constructed was the ability to re-run reports from previous months, either to compare or because the date of the monthly report has to be quite specific.
So we simply use a parameter, and then the report can be run for any date we want, we just use our new [Report Date] parameter wherever we would use the TODAY() function.
Date Detail Selector
So this one is a little esoteric and replicating something you could look to tableau to do but we had a particular problem where the tableau drill down on dates was less than useful, so a lot like a measure or a sheet selector we start with our parameter:
When we have that we can start on our two calculated fields, ore first is what will be displayed on the view, here we use a variaty of functions to format the strings that we want for each level of date detail, so for days “05 November 2017” for week “Week 40 2016” for month “December 2015” and for year “2017”
When we put this onto the view it will not default into date order so we need to have something to sort these labels by for that we use the following calculation to create dates at the level of detail that we need:
Finally, we assemble the view with DateLabel on the columns and our measure on the rows:
We can see the dates are not in the proper order, so we need to sort them by or date detail calculation
We need to make sure we are not really aggregating the date with count or count distinct rather using max or min to just return the data associated with each DateLabel.
And now we have a perfectly sorted view that we can switch between the different date details.
The last one is a classic but so very useful, using a parameter to drive a refrence line:
So we create our parameter;
We bring in our reference line setting it up to use the parameter we have created: