1 Reply Latest reply on Sep 25, 2014 3:42 AM by Jonathan Drummey

    Treasured Tip 1 - Order of Filter Evaluation


      Obs. If you want to comment the content of the tip, please do so in the original source.


      Source:__Re: Question on how to create a product velocity calculation
      Author:Joe Mako
      Date:Oct 29, 2011
      Tags:ttip   tfilter


      Here is my current working guess on an order of filter evaluation:


      1. Context Filters - temp table in data source, always evaluated first

      - Note that if you have a calcuated field that is dependant on a parameter in use as a context filter, changing the parameter value will not cause a regeneration of this temp table.


      2. Top and Condition Filters - In the filter dialog for discrete dimension pills (blue pill, non-agg), you have two tabs for Top and Condition. When these are set, they will generate a sub query and join with the data before the where clause is evaluated.


      3. General Filters on Non-Aggregated Pills - This includes pills that are dimensions (blue or green pills, non-agg), ad hoc groups, bins, sets and action filters. These are evaluated in the where clause of the query sent to the underlying data source.

      - Note that your non-aggregateion calcuation formulas will be evaluated before this point, so you could consider it filtering with a IF statement in a formula that will be evaluated before these normal and context filters.


      4. Filters on Aggregated Pills - This includes aggregrations that are a continious measure (green pills, with agg). You cannot place a pill that is a discrete aggregation (blue pills, with agg) on the filter shelf. The work around is to use a calcuated field and hare the test condition performed in an IF statement that returns a number.


      5. Filters on Custom Table Calcuations - All Table calculations will be evaluated before filtering on custom table calcuation pills is applied. Generally this is the latest useful filtering


      6. Other Late Filtering - you can filter on the fields "Latitude (generated)" and "Longitude (generated)" and filtering on them will be applied after table calculations are evalated. Also you can select dimension values in a view and select "Hide" from the right-click context menu. While this Hide operation is not really a filter, it will remove the display of the marks in that dimension value from view after table calcuations have been evaluated.


      7. Pages shelf - I think of the pages shelf like creating a "table shell" that only displays the marks for the current selection. The panes/cells and axis ranges will be bases on all possible page selections. A dimension pill on the pages shelf will be available to table calculations because the pages shelf filtering happens after table calculations are evaluated.


      Additionally of note, you can effectivly filter data inside of the formula of a calcuated field, by using things such logical or User functions, and those will be evaluated depending on your formula, either before context filters, after aggregration, or after table calcuations.


      This is my current understanding, and I welcome your corrections if I am incorrect in any of these points.

        • 1. Re: Treasured Tip 1 - Order of Filter Evaluation
          Jonathan Drummey

          Can I ask what is the purpose of this? My concern is that by duplicating content there's more likelihood that one or both parts will become stale and out of date.


          The post that you copied here is almost three years old and still useful, however it has a number of holes due to evolving understanding as well as changes in Tableau functionality. For example, in this case there are data source filters, the new style of blending introduced in 8.0, and complexities of the order of operations that impact filter evaluations, for example grand totals are unaffected by table calc filters.


          I'm not sure how best to deal with this, my ideal is that Tableau would be doing more to more fully document the product and how it's used...with us doing this as volunteers with limited time, I don't have any good ideas on how to better organize to make more accurate/timely content.