4 Replies Latest reply on Jun 5, 2012 1:43 PM by Mike Balfour

    Multi-line date formatting?

    Mike Balfour

      I have a Gantt chart showing a week's worth of data.  The X axis is currently formatted with a custom format of "ddd m/dd", which gives me axis labels that look like "Sun 5/13".

       

      This is pretty good, but for the resolution I need to display this graph at, I need to crunch the display horizontally a bit.  I *could* rotate the axis labels, but that isn't quite as readable at a glance.  My ideal would be to have multi-line axis labels, so that it looks like this:

       

      __________________________________________

        |          |           |          |          |         |         |

      Sun     Mon     Tue     Wed     Thu     Fri     Sat

      5/13    5/14     5/15    5/16     5/17    5/18   5/19

       

      The best documentation on custom date formatting that I've found is here:

      http://www.clearlyandsimply.com/clearly_and_simply/2011/04/tableau-quick-tip-2-custom-number-formats.html

       

      Nothing lists any format parameters for line breaks in custom formats.  Is it possible?

        • 1. Re: Multi-line date formatting?
          Jonathan Drummey

          Hi Mike,

           

          I've never seen anything allowing for line breaks in custom formats, that could be a good post for the Ideas section of the forums. (along with line breaks in axis titles and headers).

           

          Jonathan

          • 2. Re: Multi-line date formatting?
            Tracy Rodgers

            Hi Mike,

             

            What if you created a calculated field similar to the following?

             

            left(datename('weekday', [Order Date]), 3) + '             ' + str(datepart('month', [Order Date])) + '/' + str(datepart('day', [Order Date]))

             

            Then, place this in place of your date field and sort it by the date field.

             

            Hope this helps!

             

            -Tracy

            1 of 1 people found this helpful
            • 3. Re: Multi-line date formatting?
              Mike Balfour

              Great suggestion!  You can also replace the '        ' with a CHAR(10) and I think that will actually cause the line break.

               

              In my specific case, I don't think I'll be able to use a calculated string field due to the complexities of my visualization.  It's two Gantt charts overlaid on top of each other, with some serious calculations going on along the date axis to get the lengths and colors of the bars correct, and vertical reference bars for date boundaries and the current time.  I'm pretty sure most of it would break if I try to switch to a string-based axis.

               

              I'll definitely keep this technique in my back pocket for any more straight-forward visualizations though.

               

              In the meantime, I'll follow Jonathan's suggestion and add this to the wishlist forum.

              • 4. Re: Multi-line date formatting?
                Mike Balfour

                There's already a related Idea, so I voted it up and added the request for multi-line support to the comments:

                http://community.tableau.com/ideas/1054