2 Replies Latest reply on Nov 16, 2018 10:11 AM by Ritesh Bisht

    Custom Date -

    Raheel Farooq

      Hi All,

       

      I have a date field in the data source and now I have created different copies of the same date using different formats i.e. Exact, Month/Year and Quarters.

       

      But somehow I am unable to convert the Month/Year version into date datatype.  Also When I drag the Month/Year into the view and try to format it into custom date format it doesn't give me options to do so. Why is that so ?

       

      Thanks

       

        • 1. Re: Custom Date -
          Jeff Strauss

          Maybe what you want is to create a calculation based on the base date, something that looks like this.  This will maintain the date format, but it will truncate the detail to the month level.

           

          datetrunc('month',[your Date])

          • 2. Re: Custom Date -
            Ritesh Bisht

             

            DATETRUNC

            DATETRUNC(date_part, date, [start_of_week])

            Truncates the specified date to the accuracy specified by the date_part. This function returns a new date. For example, when you truncate a date that is in the middle of the month at the month level, this function returns the first day of the month. The start_of_weekparameter, which you can use to specify which day is to be considered the first day or the week, is optional. Possible values are 'monday', 'tuesday', etc. If start_of_week is omitted, the start of week is determined by the data source. See Date Properties for a Data Source.

            Supports ISO 8601 dates.

            Examples:

            DATETRUNC('quarter', #2004-08-15#) = 2004-07-01 12:00:00 AM
            DATETRUNC('month', #2004-04-15#) = 2004-04-01 12:00:00 AM

             

             

            ---->See more ---> Date Functions - Tableau

             

            Thanks,

            Ritesh