6 Replies Latest reply on Dec 12, 2017 10:03 AM by Hari Ankem

    Easiest way to convert string numbers to date?

    Jonathan Hodge

      Howdy All!

       

      I am working with some SQL and wrote the code to pull Year/Month:

       

      DATE_PART ('year', Date) || DATE_PART ('month', Date) AS YEARMONTH

       

      Now tableau will read it as strings: 20178, 20179, 201710, 201711, etc.

       

      I tried using a DATEPART and DATEPARSE YYYYMM but it doesn't work as many months do not have the leading zero. Example being 20178 vs 201708.

      I am quite honestly not sure if this is easier to do in SQL or now in Tableau but I wanted the results to be dates such as, August 2017, September 2017, etc.

       

      Is there an easy way to accomplish this? I attached a worksheet below with the issue.

       

      Thanks for any assistance!