3 Replies Latest reply on Dec 12, 2017 9:36 AM by Joe Oppelt

    This hour in the past

    Arthur Figueiredo

      Hello everybody.

       

      I'm having some troubles trying to create a dashboard.

       

      I need to create a filter that show our results at the same hour that I'm seeing today's results.

       

      For example:

       

      Today revenue until 12:43 = $100

       

      How can I create a filter that uses today's hour as a filter to use in 'Yesterday's Dashboard' and 'One Week Later Ago'?

       

      So it could show the comparison between days at the same period.

       

      Was it clear?

       

      Thanks!!

        • 1. Re: This hour in the past
          Joe Oppelt

          Use the DATEADD() function.

           

          If you have a field that contains a date value with a specific hour, then this will get you yesterday at the same hour:

           

           

          DATEADD('day',-1,[that field])

           

          And to look one week back at the same hour:

           

          DATEADD('week', -1, [that field])

          • 2. Re: This hour in the past
            Arthur Figueiredo

            Hi Joe!

             

            Thanks for the answer.

             

            I tried to use the formula but when I apply to the filter, Tableau ask for a type of date (relative date, for example) and then all the information desapear and the view get blank.

             

            Do you know if I have to do something?

             

            Thanks again.

            • 3. Re: This hour in the past
              Joe Oppelt

              Your filter doesn't have to be a quick filter.  It can be a calc.

               

              If [transaction date] = [date calc week ago] then 1 else 0 END

               

              Put that on your filter shelf and select for value = 1.  You'll get the data from a week ago.  (And actually that's a simplistic version of what the calc will look like.  As it stands it will only get the rows for that exact value of the date calc, but you will want all day up to that time, or some other range, so the calc will have to account for that.)

               

              I can only speak in general terms here because I don't have a sample workbook that shows what you're really doing.