12 Replies Latest reply on Jul 17, 2012 2:18 AM by Andrew Watson

    date parameter

    Anna Chan

      I have mulitiple data sources each with one commonality being the date. Is there a way i can create a date parameter, so that i can have a date slider parameter control a bunch of different charts on a dashboard?

        • 1. Re: date parameter
          Andrew Watson

          Hi Anna

           

          You can have a parameter control the date from multiple data sources. You need to create a calculated field using that parameter in each data source. For example you would have something like IIF([DateField] >= [DateParameter],1,0)

           

          Make sure this is a dimension - i.e. drag it from the measures to the dimensions - then put it into the filter field on each of the worksheets which are using the different data sources and set the value as 1. This field will have to be created for each data source but each data source can use the same parameter.

           

          Andrew

          • 2. Re: date parameter
            Anna Chan

            i have attached a workbook can you please provide an example?

            • 3. Re: date parameter
              Andrew Watson

              Hi Anna

               

              It looks like you're workbook was in tableau 6.1 so you won't be able to open the version I've done in 7 so I'll describe the steps based on what you sent through instead.

               

              1. Duplicate the Date parameter you have already created

              2. Name one of the parameters StartDate and the other EndDate and 'Show Parameter Control' for both of them

              3. Create a new calc field in the Daily Mentions data source called DateFilter. The formula is IIF([Date]>= [StartDate] AND [Date] <= [EndDate],'true','false')

              4. Drag this to the filter shelf and set the value to TRUE

              5. Repeat steps 3 and 4 for the Sentiment data source

              6. Remove your original date filters from the filter shelves leaving the parameters as the filter

               

              Note this can't be a single date slider, unfortunately this isn't possible using parameters, and also parameters don't update dynamically based on the underlying data (unfortunately but hopefully this will happen in a future release of Tableau) so you may need to load some future dates into your parameters as well.

               

              Andrew

              • 4. Re: date parameter
                Anna Chan

                Hi Andrew -

                 

                I am having trouble with the calculated field.. i typed in the formula and i am getting an unterminated string error. i also have tableau 7 installed on my work computer so the version and backwards compatability issues are not a problem.I have attached a image of the error i am currently seeing.

                 

                Thanks,

                Anna TB help file 7.16.jpg

                • 5. Re: date parameter
                  Tracy Rodgers

                  Hi Anna,

                   

                  The calculation needs an extra parenthesis before [Date]. This should allow the calculation to work.

                   

                  Hope it helps!

                   

                  -Tracy

                  • 6. Re: date parameter
                    Anna Chan

                    the parameters only work with the start date, the end date parameter appears to have no impact on selecting the data... is there a fix for this?

                    • 7. Re: date parameter
                      Shawn Wallwork

                      Hi Anna!

                       

                      You've got that [EndDate] >= to itself, so it's always going to be true. You probably meant [Date]. I bang my head on these little errors all the time, just part of coding I guess.

                       

                      --Shawn

                      • 8. Re: date parameter
                        Anna Chan

                        i changed the formula to equal date, but it seems like both are now controlling the start date and the end date parameter still isnt being controlled?

                        • 9. Re: date parameter
                          Shawn Wallwork

                          Anna, if you'll post your latest effort I'll give it a look and see if I can see what the problem is.

                           

                          --Shawn

                          • 10. Re: date parameter
                            Anna Chan

                            Feel free to use 7 as i have both 6 & 7 installed on my computer

                            • 11. Re: date parameter
                              Tracy Rodgers

                              Hi Anna,

                               

                              I believe the issue is that the way the calculation was set up was returning the incorrect results. Change the formula to look like the following:

                               

                              IIF(([Date])>=[Start Date] AND [Date]<=[End Date],'true','false')

                               

                              Hope this helps!

                               

                              -Tracy

                              • 12. Re: date parameter
                                Andrew Watson

                                Exactly, the only problem was a typing error in the formula.

                                Andrew