Learning Tableau 10(Second Edition)
上QQ阅读APP看书,第一时间看更新

Managing data source metadata

Data sources in Tableau are a definition of the connection(s). In addition to storing information about the connection (such as database server name, database, and/or file names), the data source also contains information about all the fields available (such as field name, data type, default format, comments, aliases, and so on). Often, this data about the data is referred to as metadata.

Right-clicking on a field in the data pane reveals a menu of metadata options. Some of these options will be demonstrated in the following exercise, others will be explained throughout the book. The following are some of the options available via right-click:

  • Rename the field
  • Hide the field
  • Change aliases for values of a dimension (other than date fields)
  • Create calculated fields, groups, or sets
  • Split the field
  • Change the default use of a date or numeric field to either discrete or continuous
  • Redefine the field as a dimension or a measure
  • Change the data type of the field
  • Assign a geographic role to the field
  • Change defaults for how a field is displayed in a visualization, such as the default colors and shapes, number or date format, sort order (for dimensions), or type of aggregation (for measures)
  • Add a default comment for a field (which will be shown as a tooltip when hovering over a field in the data pane, or shown as part of the description when Describe... is selected from the menu)
  • Add or remove the field from a hierarchy

Tip

Metadata options that relate to the visual display of the field, such as default sort order or default number format, define the overall default for a field. However, you can override the defaults in any individual view by right-clicking on the active field on the shelf and selecting the desired options.

To see how this works, use the filled map view of Profit by State that you created in the Connect to Google Sheets view. If you did not create this view, you may use the Orders and Returns data source, though the resulting view will be slightly different. With the filled map in front of you, follow these steps:

  1. Right-click on the Profit field in the data pane and navigate to Default properties | Number Format... The resulting dialog will give you many options for the numeric format.
  2. Set the number format to Currency (Custom) with 0 decimal places. After clicking on OK, you will note that the labels on the map have been updated to include the currency notation.
  3. Right-click on the Profit field again and select Default properties | Color. The resulting dialog gives you an option to select and customize the default color encoding of the Profit field:

Because you have set the default format for the field at the data source level, any additional views you create using Profit will include the default formatting you specified.

Tip

Consider using color-blind safe colors in your visualizations. Orange and blue are usually considered a color-blind safe alternative to red and green. Tableau also includes a discrete color-blind safe palette. Additionally, consider adjusting the intensity of colors.