Exercise - Creating a 'TopN' Filter
A free video tutorial from R-Tutorials Training
Data Science Education
4.4 instructor rating • 24 courses • 223,421 students
Learn more from the full courseThe Tableau 2018 Comprehensive Guide
Get a comprehensive skillset in Tableau and succeed in business intelligence, data visualization and in your career!
10:38:12 of on-demand video • Updated February 2019
- choose the best visualization type
- be familiar with the Tableau interface and Tableau terminology
- choose a suitable Tableau product
- writing custom codes for best results
- be a Tableau mentor for team colleagues
- perform hands on tasks in Tableau
- create custom visualizations
English [Auto] If you want to master new skills exercising is vital. Therefore you have the opportunity to test what you have learned so far your task is to recreate this exact visualization using the loise workbook. The result should be a simple bar chart which displays sales broken down by products. The interesting thing about the chart is that it has a little slider at the right hand side with the slider you can filter the visualisation for the top end products from 1 to 12. Before I let you work on the product let us summarize what we did so far creating the bar chart itself is easy and I think it doesn't require much explanation. The little slider at the site is some kind of set parameter. So this is the second thing you need to create and then you need to figure out how to bind the slider to the visualization in the previous video. We wrote a short code to include the parameter in the calculated field and then we use the field to color the boss. However in this case the parameter is feeding some sort of a filter. Therefore the third thing you need to figure out is how to include a parameter into a filter. This is pretty much it. Of course you can go back to any of the previous videos if you feel you need some repetition. So think the exercise might be a bit challenging since it's a slightly different way to use parameters but I'm sure you can tackle it and do a great job. Please stop this video now since I'm going to present a solution in approximately 10 seconds. All right I hope you try to come up with a solution because exercising is really a crucial part of any learning experience. Now let's recreate this for you. We put the sales onto the column shelf and product on the road shelf. First task checked. Now we create the parameter. So let's open an editor or I'm going to name it Top N because it's meant to control a list of top end products since we want an order. It is better to set the data type to integer current values can be anything between 1 and 12. So I'm going to let it stay at 5. Then we need to specify the allowable values. We need the range of 1 to 12. So I'm going to select range and set the minimum and maximum values step size can be specified here as well. But since the data type is integer and we want to size of one this can be skipped. Great. The parameter is ready so we can click OK and display it next to the chart by selecting show parameter control. We can use it but it doesn't affect the chart just yet. We need to bind one to another. But where to find the appropriate point of connection. So what we know is that the parameter works as a filter. They're varying it. The chart gets filtered on the product field. And this is the key we are looking for. We need to inject the parameter into a product filter. So open a filter for product. One of the four taps is called Top we already used this to create a list of top 10 elements but now we need the top end instead of the top 10. So if we open the dropdown of the value we have the main options and to a value or use a parameter among the list items there is our top end parameter. So let's select this one. We let everything else stay the same. Such a field or aggregation and we click OK if we now move the slider the chart gets filtered accordingly. So we accomplished all the tasks. Right. Hope you enjoyed the short exercise. I cannot emphasize enough the importance of training your skills actively. You can definitely expect similar sessions to come in this course.