|
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.
|
|
To format the Sales measure as currency:
-
Right-click the axis in the view and select Format.
- In the Format window make sure the Axis tab is selected.
- Under the Scale area select the numbers drop-down and select Currency (Standard).

|
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:
-
Right-click the date axis in the view and select Format.
-
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.
-
With the Format window still open, click the continuous date axis. The Format window updates to the available formatting for that field.
-
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. See if you can figure out how I labeled the marks with the abbreviated weekday. Click here to see the answer.
|
|
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.
|
|
|
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:
-
On the field menu for the distinct date, select the Minimum aggregation.
-
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.
-
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.
|
|
| |
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.
|
|
|
|