Filters

Parameter to Change Views

To swap two or more charts based on a filter, a parameter needs to be created with the possible selectors. Here is an example of two views using daily and weekly bar chart.

_images/changeview1.png

Then, we create one calculated field and dump the parameter field in.

_images/changeview2.png

Add the daily chart in a dashboard and also the parameter called interval. Make sure it is selected as daily.

_images/changeview3.png

Pass the calculated field into filters and select ‘Daily’ at the Daily Barchart worksheet.

_images/changeview4.png

Now select ‘Weekly’ in the parameter, and at the Weekly Barchart worksheet, pass the calculated field into filters, and select ‘Weekly’.

_images/changeview5.png

Lastly, add a vertical object into the Dashboard, and add both views into the object.

Filter Last Date

How do you only show data from the most recent date? This trick is sourced from http://kb.tableau.com/articles/howto/filter-on-last-date-in-the-data-source. It is achieved from the filter pop-up > Top tab.

alternate text

Top Bottom N

This trick is to have two parameters, one having an option of filtering Top N & Bottom N, or show (All). The discussion is in this link.

First create these two parameters.

alternate text

Second, create a new field that aligns the field of interest in ascending order.

rank([Speed],'asc')

Last, create a logic for linking to the two parameters

IF [Filter] = '(All)'
THEN TRUE
ELSEIF [Filter] = 'Top N' AND [rank] <= [N]
THEN TRUE
ELSEIF [Filter] = 'Bottom N'
    # reverses the values of your rank field so that you can select bottom N
    # using the same calculation that works for top N
    AND ((([rank] - WINDOW_MAX([rank])) *-1) +1) <= [N]
THEN TRUE
ELSE FALSE END