1 Reply Latest reply on Sep 27, 2016 3:08 PM by Patrick Van Der Hyde

    Apply date filter to multiple data sources on the same dashboard with ALL as an option

    Eric Sturgeon

      Hello ...  I am trying to set filters that control the same dimensions in two data sources because I have a worksheet from data source A and a worksheet from datasource B on the same dashboard.  (I normally use data blending but it did not work because I get an error about an unsupported aggregation, but that's another topic) 


      After reading some helpful How-To articles on setting filters that apply to multiple data sources, I was able to do this for [State] by creating a parameter I called [Select State] with a list of the states, and manually adding "ALL" because I need that to be an option, then in the [State] filter in each data source I put in the following formula in condition: IFNULL([State],'Null') = IF [Select State] != 'ALL' THEN [Select State] ELSE IFNULL([State], 'Null') END.  That appears to be working!  The How-To guide advised me to create calculated fields with [State Filter]=[State], then adding those to the filter and selecting "True" but this wouldn't allow for an "ALL" option so that's when I did some more searching and found that formula that allows "ALL" to be included in parameters.


      Now I am trying to do the same thing with the time period filter but I get this error: IFNULL is being called with (date,string), did you mean (date,date).


      I used the formula below:

      IFNULL([Time Period],'Null') = IF [Select Time Period] != 'ALL' THEN [Select Time Period] ELSE IFNULL([Time Period], 'Null') END


      Is there something I can substitute for "Null' to make this trick work?  Or any other way to go about it besides the cumbersome alternative of having two time period filters, one for each data source, on the dashboard?




        • 1. Re: Apply date filter to multiple data sources on the same dashboard with ALL as an option
          Patrick Van Der Hyde

          Hello Eric,


          You didn't mention the version of Tableau that you are working with so I have created the sample attached in version 10.


          I managed the first situation slightly differently than the method mentioned.


          If [Select State]="All" then "Show"


              If [Select State]=[State] then "Show" else "Hide" End




          and then I manage the Date issue in pretty much the same way:

          If [Select Month]=datetrunc('month',[Order Date]) then "Show" else "Hide" End


          You can add in the "All" by selecting a date to add to the parameter that is not in the data set.  In the example I supplied, I choose 1/1/2000 and made this calc to filter with:


          If [Select Month]=#1/1/2000# then "Show" elseif

            [Select Month]=datetrunc('month',[Order Date]) then "Show"

          else "Hide" End


          I hope this helps.