11 Replies Latest reply on Oct 9, 2018 6:00 AM by Angie Chubb

    Selecting a 5 year period

    WILL THOMAS

      Is it possible to create a slider filter or similar which can look at all data coming from a 5 year period. I have data from policy years since 2005 and want to be able to select any 5 year period since then.

        • 1. Re: Selecting a 5 year period
          Angie Chubb

          Good afternoon Will!

          I'm not sure how your policy dates are formatted, however, if you filter off of the policy date by year (so your pill is green for continuous data) and "Show Filter ,  you can then use the dropdown option to choose "Range of Dates", which would give you the slider functionality, but the user would have to ensure they're choosing 5 years of data - I don't see a way to move the slider in 5 year increments, though I may be missing something!


          Hope this helps get you part of the way there, at least.

          Angie

          • 2. Re: Selecting a 5 year period
            Don Wise

            Hello Will,

            You can follow Angie's directions to set up the date slider.  To limit it to a 5-year period. Then do the following.

             

            1. Right click the date you're using as a filter in the filter card.  Select 'Add to Context'

             

            2. Create the following calculation.

             

            Name of Calculation: MIN

            Calculation: [Date]>=(DateAdd('year',-5{MAX[DATE])}))

             

            3. Add the MIN calculation to the filter and set to 'True'.

             

            That way any dates selected will be in a 5-year range.

             

            Hope that helps.  Thx, Don

            • 3. Re: Selecting a 5 year period
              Michael Gillespie

              Don, as I read it, he wants the user to be able to select only 5-year periods (2005-2010, 2006-2011, etc.), not select dates between 2 given 5 year points.

               

              Is that right, Will?

               

              On a date slider as Angie has described it, you CAN get that functionality, but you'll have to train your users.  Here's how.

               

              Normally on a slider control, we would move either the starting point or the ending point of the range by sliding the control back and forth.  In Tableau, if you put your mouse point in between those 2 end points and click-hold-slide, both the start and end points will move but it will keep the range the same.  It's hard to describe, but try it and you'll see what I mean.

               

              That's not obvious from the UI and users wouldn't find it unless by accident.  It does work, though, if you think you can train folks to do it.

              • 4. Re: Selecting a 5 year period
                WILL THOMAS

                Thanks very much!

                 

                I have this working now.

                 

                Only problem is, my data is cutting off the lower year.

                 

                So if I have set it on 2009-2017, the values coming through are only from 2010-2017 really.

                 

                Do you know how I can fix this?

                • 5. Re: Selecting a 5 year period
                  WILL THOMAS

                  Thanks very much!

                   

                  I have this working now.

                   

                  Only problem is, my data is cutting off the lower year.

                   

                  So if I have set it on 2009-2017, the values coming through are only from 2010-2017 really.

                   

                  Do you know how I can fix this?

                  • 6. Re: Selecting a 5 year period
                    WILL THOMAS

                    Thanks Don.

                     

                    In the end, I realised it is not that important to be limited to 5 years and I can in fact give the flexibility to the user.

                     

                    Only problem is, my data is cutting off the lower year.

                     

                    So if I have set it on 2009-2017, the values coming through are only from 2010-2017 really.

                     

                    Do you know how I can fix this?

                    • 7. Re: Selecting a 5 year period
                      Angie Chubb

                      Hi Will!

                      Are you able to provide some info on the calculation or filtering you're using? We may be able to better assist.

                       

                      Thanks!

                      Angie

                      • 8. Re: Selecting a 5 year period
                        WILL THOMAS

                        Angie,

                         

                        Does this screenshot help?

                         

                         

                        In excel, the policy year formatting is just 2011, 2012 etc. Not a specific date.

                         

                        Thanks again.

                        • 9. Re: Selecting a 5 year period
                          Angie Chubb

                          Hi Will!

                          Interesting....with the screenshot you provided, it looks like there's actual dates involved. When I pull in a dummy spreadsheet I created with just year (not formatted as a date), it allows me to just choose the values I want on a slider, because it's not looking at it as a date, the data source has it formatted as a number - not sure what is appropriate for your data source.


                          I feel like with the Range of dates, you'd have to type in 1/1/2010 and 12/31/2017, respectively, to get the actual chunk of dates you're looking for, vs. using the slider itself, because it will look at any date, not just the year.

                           

                          If you change your filter to be discrete, instead of continuous, you get only the year values, but you lose the slider option when showing the filter. Not sure if anyone else has any better ideas, but using checkmarks may be a more viable option than the slider.

                           

                          Let me know if this helps!

                          Angie

                          • 10. Re: Selecting a 5 year period
                            WILL THOMAS

                            I set the dimension data type to 'date' so that I could use the select date range option in the filter you see.

                             

                            Not sure if I can have the slider option without setting it as a date ?

                            • 11. Re: Selecting a 5 year period
                              WILL THOMAS

                              Ignore me - fixed it!! Thanks very much.

                              • 12. Re: Selecting a 5 year period
                                Angie Chubb

                                Awesome, glad to help!!!

                                 

                                Please be sure mark your question as answered/helpful.