2 Replies Latest reply on Feb 26, 2017 10:32 AM by Jonathan Drummey

    Date calculation returns null

    Nitya KS

      I am trying to create date time from 2 strings. But the calculated value returns NULL. Can someone help me figure out what is wrong? Attaching snapshot for details

      DATEPARSE("MM/dd/yyyy hh:mma",[Entry.END DATE]+" "+[end_time])


        • 1. Re: Date calculation returns null
          msa s

          MAKEDATETIME(date, time)


          TRY THIS ONCE


          9.3 version




          FIRST SPLIT , RIGHT CLIK ON first column and then use ", mention 2 splits


          and then for  F1-Split2  ,click custom split and then use , ALL and  then


          F1-Split2-Split2  ,click and then split or custom split use :  ,  then mention 3 or  clik ok , then it is divided into 7 ,59,0 convert those three to whole number and combine using MAKETIME




          split and convert


          after split you need to convert then to  time part into number and then do MAKETIME and then include this    makedatetime(f1-split1,MAKETIME)



          is this fine

          • 2. Re: Date calculation returns null
            Jonathan Drummey



            I just mocked up some text data in the format based on your screenshot and it worked just fine:


            Screen Shot 2017-02-26 at 1.28.22 PM.png



            However, there's an even easier solution using Tableau's DATETIME() function, which takes a datetime string as an argument and can read a number of different common date time formats:


            Screen Shot 2017-02-26 at 1.29.13 PM.png


            If you really want to figure out what's failing with the DATEPARSE I'd suggest first of all doing two separate dateparses, like these:


            DATEPARSE("MM/dd/yyyy", [Date])

            DATEPARSE("hh:mma", [Time])


            Then if one or both of them is failing the problem might be due to extra spaces, so trying the dateparse with TRIM() wrapped around the date & time dimension would be next.


            v9.3 workbook is attached.