2 of 2 people found this helpful
From the Desktop Online help:
"By default, all filters that you set in Tableau are computed independently. That is, each filter accesses all rows in your data source without regard to other filters. However, you can set one or more categorical filters as context filters for the view. You can think of a context filter as being an independent filter. Any other filters that you set are defined as dependent filters because they process only the data that passes through the context filter."
This is now much more relevant because in 9.0 LOD expressions are applied at different points in the filter order of execution:
When we use a FIXED LOD calc, the expression is calculated after the Extract, Data Source & Context filters, but before the Dimension, Measure & Table Calc filters. This let's us do things like calculate a percent of total without having to use Table Calcs, as we use to do.
But there might be cases where you want some Dimension filters to effect a FIXED LOD. By adding the Context to a Dimension filter you move it up in the order of execution ahead of the FIXED LOD.
Beware of using lots of Context filters as they can slow down performance.
1 of 1 people found this helpful
We use "Context" filters to improve Report Performance, Main usage is it is scanning the limited amount of data not entire data base. Like Slice performing in the Cube.
For an example we are having the Data for year 2010,2011,2012,2013,2014.
Normal Filter: Year 2012,2013,2014. ------- Here Report scans all records of the Database then applying the filter.
Context Filer: Year 2012,2013,2014------ Here Context filter will scan the data of year 2010,2011,2012.
And Context filter is applicable to the all reports which are using the database.
It used to show only related data in another Filter.
If we define the Relevant between Country & States (Country to States),
If we select Country "USA", USA related values only available in State Quick Filter.
It works by attempting to create a TEMP table in the database (which may or may not always succeed, depending on the database and your permissions - we are assuming that TEMP tables succeed for this blog post).
In an actual test against a 40 million row table, we ran a context filter on a very wide and a more narrow Tableau result set. The wide data connection took 47.57 seconds to A) create the TEMP table, B) index the columns and C) query the "number of records". You can see all of this in the Tableau desktop logs. By the way, it's worth pointing out how amazing this fact is, that Tableau generates all of the correct SQL code for this. However, the result is huge and wide. This data connection had 50 dimensions and 32 measurements.
We ran the same exact "add to context" test against a second data connection which only had 11 dimensions and 4 measurements. This time the query took 13.98 seconds. This was a 340% reduction in query time!
2 of 2 people found this helpful
I appreciate the comments by Shwan and Sai and adding on it-
Context filters are used for a hierarchical drill down where a user want to reach at a granular level during it's analysis. They are used when we don't want all the values to come up in the filters rather we want only the relevant values related with each other to come up.
For example - Suppose you have a hierarchy of country-->state--->city so if you make country as a context filter and change state and city as "All values in Context", the filters will show you only relevant state and cities of the particular country and not for all countries. The main benefit of this is it improves the Dashboard performance as only relevant values are picked for the filters not all the values.
Hope this helps you!!
4 of 4 people found this helpful
Just a quick comment.
Performance is secondary for Context Filters feature since not all databases actually benefit from particular query rewrites that Tableau is doing. Plus, since implementation is not targeting performance, we might (and actually did) change behavior related to context filters in on of recent releases.
Primary focus for these is interaction with other filters and order/priority definition.
Best way to understand it is actually try it out.
For example, add a filter on Customer Name of type "Top 10 by SUM(Sales)". Then add filter for specific region what would filter out bunch of customers. Then add first filter to context.