9 Replies Latest reply on Dec 4, 2017 9:19 AM by Tyler Garrett

    Update Date Slider to Current Day

    Nathan Jones

      Hi team,

       

      I've got a dataset that spans about a year, with values for every day.  I would like this date range to automatically update to the last month, so if it's December 15th, I want to see December 1-15th.

       

      Currently, I'm going with a solution that looks like this:

       

      date_1.jpg

       

      The parameter selection filters down the dates in the slider to relevant values, and it seems to work well.  The TWO issues I have with this is that:

       

      a)  My client thinks it's confusing to have two date fields, and

      b) Once you move the slider, the parameter switch gets broken and no longer works

       

      So my question is: is there any possible way to have a simple date slider that updates dates dynamically based on the current date?

       

      I've looked around, seen this, and various other solutions people have proposed, and I've even tried Tableau's proposal, but you end up with a long long list of dates:

       

      date_2.jpg

       

      That's undesirable, I think.  Any thoughts or ideas?  I'm pretty sure this is impossible, and my hacky solution is about as good as it's going to get, but wanted to check in with the gurus first.

        • 1. Re: Update Date Slider to Current Day
          Jim Dehner

          Hi Nathan

          is there a special reason you want a parameter with slider

           

          you can use the formula shown below as a Boolean filter set to true and get the current month

           

           

          Jim

          If this posts assists in resolving the question, please mark it helpful or as the 'correct answer' if it resolves the question. This will help other users find the same answer/resolution.  Thank you.

          • 2. Re: Update Date Slider to Current Day
            Nathan Jones

            Hey Jim -- this is actually more or less the functionality I'm using for the calculations behind the parameter -- I'm aware of this, was specifically wondering if there was a way to do it with a slider, or at least in a more streamlined fashion than the possibilities I've shown above...

            • 3. Re: Update Date Slider to Current Day
              Tyler Garrett

              Here I had a request similar to this.

              IMG_1106.JPG

              Parameters are man/women made objects that would require an update each day, and a re-upload. So i don't think a parameter is what you need.

               

              Use getdate() currentdate() or whatever the case might be (depending on the syntax of the database) to generate the flag every morning.

               

              Which will require a job to run prior to the generation of the extract. Ask the data expert internally.

               

              Select [dimension], currentdate(), etc... from table1 etc...

               

              Another method of generating a 'datasource' max date - is also found quickly by generating a sub select in your select statement...

               

              select [dimension], (select max([date]) from table1 etc) d, etc... from table1 etc... This allows you to divert away from {thislod}

               

              Finding the datasource maxdate is crucial to offering the chart above.

               

              SQL first, product second.

               

              Best,

              Tyler

              Dev3lop

              • 4. Re: Update Date Slider to Current Day
                Jim Dehner

                Ok here is a way to do it - see attached

                First I had to use superstore data

                 

                start with a formula to identify the dates you need

                 

                 

                then follow the path below to create your parameter

                 

                 

                 

                 

                Jim

                If this posts assists in resolving the question, please mark it helpful or as the 'correct answer' if it resolves the question. This will help other users find the same answer/resolution.  Thank you.

                • 5. Re: Update Date Slider to Current Day
                  Tyler Garrett

                  Jim, Now try updating the extract - to see if it updates with new data on a Tableau Server or Tableau Online instance.

                   

                  Parameters are hardcoded values if you set it to date.

                  1 of 1 people found this helpful
                  • 6. Re: Update Date Slider to Current Day
                    Nathan Jones

                    Yep, this is my concern.

                    1 of 1 people found this helpful
                    • 7. Re: Update Date Slider to Current Day
                      Tyler Garrett

                      Yes sir. That's why you need to make your parameter effectively work AROUND the dates... Not work with the dates. Because that means you have to UPDATE the parameter.

                       

                      Furthermore, just because it works in the product. Doesn't mean it will work when say... Sql server updates the data.

                       

                      Which is why I'm saying, Solve with SQL before Tableau.

                       

                      Best,

                      Tyler

                      Dev3lop

                      1 of 1 people found this helpful
                      • 8. Re: Update Date Slider to Current Day
                        Tyler Garrett

                        This will do what you need, and will require a {max(date)} if you're not comfortable using SQL. It utilizes a parameter to feed the amount of days/months/etc.

                         

                        Enjoy,

                        Tyler

                        Dev3lop

                         

                        Screen Shot 2017-12-04 at 11.09.06 AM.png

                        1 of 1 people found this helpful
                        • 9. Re: Update Date Slider to Current Day
                          Tyler Garrett

                          Just a note, Jim please check this out too.

                           

                          Deeper analysis.

                           

                          Notice I'm forcing the user into a parameter that is integers... Now they only pick one value, not two. You can also replace the maxdate with a parameter but here we are with the exact same problem, you can't add a parameter with a date in it unless you understand it will always be static. Because... Parameters are man/women made. Ergo why would it 'magically update?' That's not what parameters are designed to do currently.

                           

                          Parameters are meant to feed into calculations to manipulate at a user level. Not magically refresh.

                           

                          Parameters do not change based on the data... if you're stuck with dimensions -> This works around parameters.

                           

                          When you want something to work without that update, you will need to get out of the box and away from putting content into the parameter -> Unless you like support and remediation. I personally do not - and I'm hungry to move on and work on something new.

                           

                          That's why I built this calculation - because I didn't want to sit, support, and remediate this solution for years. Rather - I moved on to another customer.

                           

                          Best,

                          Tyler

                          Dev3lop

                          1 of 1 people found this helpful