1 Reply Latest reply on Feb 20, 2013 12:24 PM by john.daniels

    Calculated Fields ignore data filters?

    john.daniels

      We are just getting up to speed on Tableau so please forgive me if I am missing something obvious.

       

      We have a workbook that is going against a SQL data source.  It has 8 or 9 dimension tables and one fact table with all the joins defined between.  We have defined a date filter so that the viz will only show the last 3 months of data. 

       

      We created an Age Group calculated field that is defined as:

      IF [IMC_PRM_AGE_YRS_QTY] >= 55 THEN "55+"

      ELSEIF [IMC_PRM_AGE_YRS_QTY] >= 45 THEN "45-54"

      ELSEIF [IMC_PRM_AGE_YRS_QTY] >= 35 THEN "35-44"

      ELSEIF [IMC_PRM_AGE_YRS_QTY] >= 25 THEN "25-34"

      ELSEIF [IMC_PRM_AGE_YRS_QTY] >= 18 THEN "18-24"

      ELSE "Other" END

       

      The viz was taking 4-6 minutes to return only 3 months worth of data so we decided to look at the TSQL executing behind the scenes.  So Tableau does an initial query against the tables using the date filter (3 months).  It then executes a query that is getting the age group calculated field as defined above.  The problem is that it is doing a SELECT big case statement to get the age Group FROM all the tables defined in the data source but it doesn't use a date filter.  So it is doing this select against million rows of fact tables from all of time instead of only looking at the last 3 months.  What are we missing?  Is this how Tableau should be behaving?  We have tried making the filters global and moving the order of the filters around but nothing changes the behavior.  There has to be something that we are missing to force the calculated fields to honor the date filters.

       

      Any input would be appreciated!


      Thanks,

      John