2 Replies Latest reply on Nov 21, 2016 12:00 PM by Matt Hong

    Need to Format Date in through Calculation

    rohit chourasia

      hi guys,


      Please help, I need to create date in the format of 'YYYYMM" like of the is DD/MM/YYYY i need it as "YYYYMM".


      Thanks in Advance,



        • 1. Re: Need to Format Date in through Calculation
          Sarah Ebreo

          To keep the field as a date you can format the date using the following steps:

          1. Once the date field is placed on the view, right-click and select Month (May 2015) and change the date to Discrete.
          2. Right-click the date field again and select Format.
          3. In the Header Default section click the drop-down for Dates and click Custom at the bottom of the list
          4. Enter YYYYMM as the new Format. This will display 23/02/2016 as 201602.



          More information about using custom date formatting can be found here in the product help: http://onlinehelp.tableau.com/current/pro/desktop/en-us/help.htm#dates_custom_date_formats.html


          Another option is to use a calculated field to display the date as a string. This field will not have any of the date field properties (won't be able to drill down). You can use following formula:

          STR(DATEPART('year',[Order Date])) + STR(DATEPART('month',[Order Date]))


          I've included a sample workbook illustrating both options. Hope this helps!


          • 2. Re: Need to Format Date in through Calculation
            Matt Hong

            1. Your desired calculation is DATEPARSE('dd/MM/yyyy', [Date field])


            2. After creating this field, right-click on the field and navigate to Default Properties -> Date format...


            3. Scroll down on the list and click 'Custom'. Type: yyyyMM


            4. Place this calculation on the worksheet, then right-click on the field and select Exact Date.