See all tips | View as pdf

Formatting Numbers and Dates

Tableau’s formatting window lets you change fonts, add banded shading, and modify the lines, colors, grid, and more. For this tip I want to focus specifically on formatting numbers. For example, you may be looking to do something as simple as show a measure with a dollar sign or use a custom date format. Or you may want to format a date that is aggregated to the M/D/Y level. With a few tricks you can get your numbers formatted just how you want without even writing a calculation.

Here's how it works.

Change a measure to currency

The view below uses the Sales measure to show Sales over time.
A view showing sales over time aggregated by Month.
To format the Sales measure as currency:
  1. Right-click the axis in the view and select Format.

    Right-click and select format.

  2. In the Format window make sure the Axis tab is selected.

  3. Under the Scale area select the numbers drop-down and select Currency (Standard).

    Select a number format.
Note: You can instead select Currency (Custom) to specify the number of decimal places, how to show negative values, the units, whether to include a prefix or suffix, and whether to include thousands separators.

You can also select a custom currency format.

Custom Date Formats

The same view now shows sales over time with sales formatted as dollars. Next let's format the date axis to show a custom format such as Sunday 1/1 or Aug 19 instead of just August.
To specify a custom date format:
  1. Right-click the date axis in the view and select Format.

    Right-click the date axis and select Format.

  2. In the Format window notice that the Numbers area for Headers is inactive. That’s because the dates are being aggregated by Month, which doesn't support date formatting. One alternative is to aggregate using the All Values option. Select All Values on the date's field menu.

    Aggregate the date field using All Values.

  3. With the Format window still open, click the continuous date axis. The Format window updates to the available formatting for that field.

  4. You can specify a new date format using the Dates control in the Scale area of the Format window. Choose from a variety of formats or create a custom format. The table below describes the values you can use for custom date formats. For this example we’ll use the format DDDD DD so that it shows the Weekday and the Day.

    Select a custom date format of DDDD DD.
The resulting view is shown below with the sales measure formatted as dollars and the date axis showing the weekday and the day. See if you can figure out how I labeled the marks with the abbreviated weekday. Click here to see the answer.
Final view showing custom date formats and measures formatted as currency.

Formatting distinct dates

In the previous example, the Date fields are aggregated to the All Values level, which creates a continuous axis. But what if you wanted to keep the distinct headers and still use a custom date format? For example, the view below shows the same view as before but this time it shows the sales for each distinct Month, Day, and Year.
A view showing sales over time aggregated to the M/D/Y level.
As we already learned, if you try to format this date the number formatting is not available. That's because the M/D/YY date level is not actually a date, its just a bunch of text.

To format distinct dates:
  1. On the field menu for the distinct date, select the Minimum aggregation.

    Select the Minimum aggregation on the date field menu.


  2. Drag the Date field from the Data window to the Level of Detail shelf and select the distinct date level you want. In this case select the M/D/YY level.

    Put the date field aggregated at M/D/YY on the level of detail shelf.


  3. Right-click the Date headers and select Format. In the Format window you can now specify a custom date format or select from the list of common formats.

    Format the date using the Format window.
 

To Learn More

  • Learn more about Formatting by searching for Formatting in the Tableau Online Help.
  • Contact Tableau Technical Support at: (206) 633 3400 x2
  • Learn this trick and many more at the Tips and Tricks index. Don't forget to bookmark it.