Formatting Numbers and Dates

RELATED ARTICLES

Product(s):  Tableau Desktop
Version(s):  All
Last Modified Date:  18 Jan 2012
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.

Change a measure to currency

The view below uses the Sales measure to show Sales over time. By default, the Sales numbers are not formatted as currency.

To format the Sales measure as currency:

Step 1

Right-click the axis in the view and select Format.

formatting_numbers3.png

Step 2

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

Step 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.

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:

Step 1

For Tableau Desktop 7.0 and later, right-click the field, and select the continuous Month date level. The dates are now truncated to show each month and year along a continuous axis.
For Tableau Desktop 6.1 and earlier, right-click the field, and select All Values.

Step 2

Right-click the Order Date field, and select Format.

Step 3

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.

The resulting view is shown below with the sales measure formatted as dollars and the date axis showing the weekday and the day.

Formatting distinct dates

In the previous example, the Date fields are truncated to the Month 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.

 

To format distinct dates:

Step 1

For Tableau Desktop 7.0 and later, right-click the date field on the Columns shelf, and select Discrete.
For Tableau Desktop 6.1 and earlier, right-click the date field on the Columns shelf, and select Measure > Minimum aggregation.

Step 2

Right-click the field again, and select Format.

Step 3

As before, you can format the dates using the Date control in the Default section of the Format window. You can select from predefined formats or select Custom.

Alternate Search Terms: How To Dates and Times Formatting
Need more help? Contact Support


ATTACHMENTS





Search Knowledge Base