3 Replies Latest reply on Sep 8, 2016 6:56 AM by kettan

    How do I make tableau display dates as "Month day, Year"?

    Emmanuelle Larco

      Hello,

       

      I have a field called "Date" and a calculated field called "Yesterday" that is just "today()-1".

      I also have a parameter that have different ranges like "yesterday", "week to date", "month to date"....

      Based on the parameter value, Tableau will filter the data. For example, for week to date, I have a calculated field that says:

      If Date >= STR(([Yesterday]) +(8-datepart('weekday',[Yesterday]+1))-6) THEN 1 ELSE 0 END

      This formula will count all records for week to date.

       

      Now, I want to display the date range chosen based on the parameter value. For example, I would want to show something like that:

                 DATA DISPLAYED FOR

      April 15, 2015 to April 19, 2015.

       

      Right now, to transform a date to the "Month day, Year" format, I use:

           STR(datename( 'month' ,[Yesterday])) + " " + str(day([Yesterday])) + ", " + str(year([Yesterday]))  (this is the formula for yesterday's date).

       

      So my question is: Is there another efficient way to do it? Like a function that would give me this format?

      I have so many parameters that transforming the dates the way I have started is just tedious and time consuming.

       

      I have also tried: STR(Dateparse("dd.MMMM.yyyy", STR([Yesterday]))) But then I just get a blank value. (I need the result to be in the string format because I am concatenating it with another string.

       

      Thanks,