3 Replies Latest reply on Jul 10, 2016 11:42 AM by Carl Slifer

    How can you make a datetime filter which has 15 minute slider increments?

    . Tableautester

      If you have a database table with a timestamp data type and you make that field a filter, you can select Range of Dates sliders.

      How do you make Tableau increase or decrease when you move either side of the slider by 15 minute increments?

       

      You can make a calculated field called TimeBin to determine which 15 minute bucket the minutes of the timestamp fall into by this code:

       

      IF     DATEPART('minute', [myDate])<15 THEN                                                        '0'

      ELSEIF DATEPART('minute', [myDate])>14 AND DATEPART('minute', [myDate])<30 THEN '15'

      ELSEIF DATEPART('minute', [myDate])>30 AND DATEPART('minute', [myDate])<45 THEN '30'

      ELSE                                                                                                                        '45'

      END

       

      Then you can put the 15 minute buckets back into the timestamp by creating a calculated field called TimeBinFilter with this code:

      DATETIME(STR([myDate]) + " "

      + STR(DATEPART('hour',[myDate]))+ ":"

      + STR([TimeBin])+":"

      + STR(DATEPART('second',[myDate])))

       

      The Range of Date slider for TimeBinFilter currently changes by hour increments unless the user types in a specific minutes.

       

      Here is some sample data: