5 Replies Latest reply on Nov 15, 2019 3:15 PM by Kaz Shakir

    Time comparisons

    Vinay Seeruthun

      Hi there,

       

      Can anyone help me with time comparisons. I'm trying to group my times into 15 minute intervals but i'm getting the error below:

       

      Untitled.png

       

      IF [Actual Entry Time] >= #00:00:00# AND [Actual Entry Time] <= #00:15:00# THEN #00:15:00#

      ELSEIF [Actual Entry Time] >= #00:15:00# AND [Actual Entry Time] <= #00:30:00# THEN #00:30:00#

      END

       

      Thanks

        • 1. Re: Time comparisons
          Kaz Shakir

          Vinay Seeruthun,

          What data type is [Actual Entry Time]?  It appears, from the error message, that it might be a string data type.  If so, can you parse it to a time data type (try using either the DATETIME function or the MAKETIME function)?

           

          Kaz.

          1 of 1 people found this helpful
          • 2. Re: Time comparisons
            Vinay Seeruthun

            Hi Kaz,

             

            Thanks for the reply.

             

            Can you help me with the syntax of using this function? I'm currently getting an error as shown below:

             

            Capture.PNG

             

            Best Regards,

            Vinay S

            • 3. Re: Time comparisons
              Michael Gillespie

              Vinay, there is a very small arrow on the right side of the calculation editor.  Click on it and the window will expand to show you the syntax of all the built-in operators in Tableau.

               

              You are passing the exact same field 3 times to that function.  That's not how it works.  Look at the syntax example when you click on that arrow.

              • 4. Re: Time comparisons
                Vinay Seeruthun

                Thanks for this Michael - This is a great tip.

                 

                However, I thought the purpose of MakeTime is to convert my string into an integer time.

                When I hover over my data source to change it into time, Tableau does not give me the option?

                 

                Untitled.png

                 

                Best Regards,

                Vin

                • 5. Re: Time comparisons
                  Kaz Shakir

                  Vinay Seeruthun,

                  I think the reason you are getting the menu that you have shown in your screenshot is because you clicked on the drop-down arrow head.  Instead, try to click on the datatype itself.  For example, if the column is a text data type then you want to click on the "Abc" (circled in red in the screenshot below, and Tableau will give you a list of the datatypes from which you can choose.  When you choose a different datatype, Tableau will attempt to convert the contents of that column into the data type you selected.

                  Kaz.