L1 connect to and customize data
Published:
Tableau Fundamentals
Connect to and Customize Data
Connecting to Data
Tableau data connections
- Types of data connections
data might be stored on your computer in a spreadsheet or a text file, or in a database on a server in your enterprise
public domain data available on the web, such as U.S. Census Bureau information, or to a cloud database source, such as Google Analytics, Amazon Redshift, or Salesforce
- supported connectors
- Live connections vs. extracts
By default, live connection to your data.
- Live connection
- direct connection to your data
- leaves the data in the database or source file
- best when you want to leverage a high performance database’s capabilities, or to get up-to-the-second changes in data visualized in Tableau
- can result in a slow experience, depending on the database.
- Extract
- compressed snapshot of data stored locally and loaded into memory
- extract the data into Tableau’s high performance in-memory data engine.
- useful when you connect to a slow database or when you want to take query load off critical systems.
- can choose to import only some of the data and bring in specific elements to the extract.
- To access those options, click Edit.
- If the original data source changes, you can also refresh the data in the extract by clicking Refresh
Connect to a data source
- Tableau can connect to a number of different flat file types as well as a wide range of server-based data sources.
- In this module, we will connect to a single, file-based data source.
- You can also connect to multiple data sources at a time and use relationships, joins, unions, and blends to work with the data.
- The types of flat files you can connect to include Microsoft Excel files, text files, JSON files, PDF files, and more.
- In the Connect pane, click the file type that matches your data source. In the Open dialog box, select the data source and click Open. You are now connected to the data.
- Tableau Desktop: Connect to a data source
- In the Connect pane, click the file type that matches your data source.
- In the Open dialog box, select the data source and click Open.
- Tableau Online (Explorer): Connect to a published data source
- From the Home page, select Workbook. or From the Explore page, open the New menu and select Workbook.
- In the Connect to Data dialog box, select the data source and then click Connect. You are now connected to the data.
- Tableau Online (Creator): Publish and connect to a data source
- With Creator permissions, you can also publish a data source:
- From the Home page, select Workbook. or From the Explore page, open the New menu and select Workbook.
- In the Connect to Data dialog box, switch to the Files tab.
- Click Upload from computer to browse for the file.
- In the Open dialog box, select the data source, and then click Open.
- You are now connected to the data.
Explore connected data
Once you’ve connected to a data source, Tableau opens to a workbook with the data loaded. This is the Data Source page.
The Data Source page
- File Name
- Sheets within the Excel Sheet
- Connection live or extract
- Canvas
- No of Preview Rows
- 1000
- Data Grid Fields
- Data Grid Rows
Manage metadata
Metadata describes your data.
It includes the names of fields and data types as well as aggregation information and default display properties.
Tableau assigns metadata to the data that you bring into Tableau; you can edit the metadata in a way that better supports how you want the fields to look and function when you’re building a view.
In the data grid, Tableau shows some of the metadata for the dataset, such as data role and field name.
Tableau distinguishes numbers from strings and even dates from dates with timestamps.
Tableau represents these data role assignments with an icon near the field label.
For example, Tableau recognizes City as a geographic entity, and therefore assigns it a Geographic Role (a common data role) connecting that field to Tableau’s generated latitude and longitude coordinates.
Note: This does not change the data type, which will remain as a string in this case.
To change a data role:
- Click the data role icon you wish to change.
- Select the new role type. The data role is updated.
Changing the data role assignment does not change the data type.
To rename a field:
- Select the dropdown menu above the field you want to rename.
- Select Rename.
- Type the new name.
- Click outside the field name to apply the change
Metadata grid
If you need to reference something quickly or wish to see some of the name changes that you’ve made, click the Manage metadata button to switch to the metadata grid view.
The metadata grid displays the fields in your data source as rows so that you can quickly examine the structure of your Tableau data source and perform routine management tasks, such as renaming fields or hiding multiple fields at once.
While you can edit the data role and field name, you cannot change the Table or Remote Field Name information.
This is because changes to the metadata in Tableau don’t impact the source data.
The Tableau workspace
In the Tableau workspace, the Data pane lists the fields from the data source, organized into dimensions and measures.
You can drag the fields from the Data pane to the cards and shelves to begin creating visualizations.
- Data Pane
- Columns from data source are shown as fields
- Fields are organized by Table
- For each table or folder
- Dimensions Fields (Blue Icons)
- Gray Line
- Measure Fields (Green Icons)
- Modifications can be made
- Pages Shelf
- Break a view into series of pages
- to navigate like flip-book animation
- Break a view into series of pages
- Filters Shelf
- Specify data to include or exclude
- Marks card
- Fields can be dragged to different properties to add context and detail to the marks in the view
- We can set marks type and encode data with color, size, shape, text, and detail
- Columns and Rows Shelves
- Data Pane
Refresh live data
By default, Tableau maintains a live connection to your data, so as new data is added, it can be incorporated into your analysis. To refresh the data source:
Right-click the connection name in the Data pane.
Click Refresh
This updates the existing view to include any new data.
Tableau will also refresh the data automatically each time you open the workbook
Try it! Connect to a data source
- Connect to an Excel spreadsheet with Tableau Desktop.
- Connect to a published data source file with Tableau Online.
- Activity: Connect to an Excel file with Tableau Desktop
- Connect to the Excel file, data_connection_practice.xlsx.
- Rename the data source to “My Orders Data”
- Load the Orders sheet
- Change these field names: Row to “Row ID” and Global Area to “Country”
- Change the data role for the Country field to the geographic role of Country/Region
- On the Sheet 1 worksheet, open a field’s dropdown menu to view customization and other options there
- Activity: Connect to a published data source with Tableau Online
- Now’s your opportunity to apply what you’ve learned about how to connect to a published data source with Tableau Online or Tableau Server.
- The guided activity below will prompt you to take specific actions and provide feedback and guidance along the way.
Customizing a Data Source
Customize a data source
When analyzing data, you may need to do some cleanup and organization as you work with the underlying source data.
This could include customizations like connection information, organizational or metadata changes, attributes, or aliases.
Tableau Desktop makes it possible to save these data source customizations for reuse, which we’ll explore in the next lesson.
Note that Tableau preserves the customizations you make, but it does not change the underlying source data.
Work with metadata
Metadata is information about the data, like field name or data type, or default aggregation.
It’s possible to edit the metadata from several places, but in this module, we’ll focus on editing in the worksheet.
Common changes to data attributes fall into several categories, all of which are saved in a Tableau data source (.tds) file:
- Folder structure
- Measure and dimension conversions
- Field data types (e.g., strings, integers, dates)
- Field properties (e.g., how a field is displayed or aggregated)
- Attributes (e.g., field names)
- Remember that these customizations don’t affect the underlying source data.
Organize fields into folders
- When you have a large number of fields in the Data pane, it can be helpful to organize dimensions and measures into a more efficient folder structure.
- For example, you may want to organize all the customer fields, such as Customer Name and Customer ID, into a new folder called “Customer Info.”
- To organize fields into folders:
- Click the Data pane menu and select Group by Folder.
- Right-click one of the fields you wish to add to the folder, point to Folders, and select Create Folder.
- In the Create Folder dialog box, give the new folder a relevant name.
- Click OK.
- Drag the desired fields into the folder.
- To simplify the list of fields on display, click to open or close the folder.
Convert fields from measures to dimensions
- Tableau automatically predicts whether your fields are dimensions or measures, but sometimes you may want to re-categorize a dimension as a measure or vice versa.
- This might happen when a numeric identifier field gets categorized as a measure when you actually want it to be a discrete dimension.
- For example, you may want to change the Row ID field to a dimension if these aren’t numbers you want to add up or average.
- To change a measure to a dimension, drag the measure to the Dimensions area.
- Similarly, to change a dimension to a measure, drag the dimension to the Measures area.
Edit attributes
- Databases don’t always use human-readable titles or names that make sense to your audience. To make the field names more intuitive, Tableau allows you to rename any of the database fields. This is especially helpful when you are sharing a data source with other users.
- For example, if you want the name of the Country field to be Country/Region:
- Right-click the Country field and select Rename.
- Revise the field name. In this case, we’ll change it to “Country/Region”.
- Press Enter
Create aliases to rename members in the view
To clarify the meaning of the labels associated with discrete dimension members in the view, Tableau allows you to create aliases, or alternate names
For example, if you have a dimension Storm Name with a member named “Subtrop 1,” you can create an alias to apply the actual storm name.
You cannot create aliases for dates, measures, or the members of continuous dimensions
To create an alias:
In the Data pane, right click a dimension
Select Aliases
In the Edit Aliases dialog box, select the Member you want to edit
Type the new alias.
Click OK
Notice that the Has Alias column now has a * to indicate that the member has an alias
When you add the field to the view, the alias names will appear as labels in the view
|
|
|
| | ————— | —————- | —————- |
Edit a field’s default properties (Tableau Desktop only)
You can edit a field’s default properties, such as color, number format, or aggregation. This way, every time you add the field to the view, it will maintain its assigned properties.
For example, if you want the Sales field to default to currency with no decimals:
- Right-click the Sales field to open the menu.
- Go to Default Properties and select Number Format. The Default Number Format [Sales] dialog box opens
- Select Currency (Custom)
- Set the Decimal places to 0
- Set the Display Units to Thousands (K)
- Click OK
- Now, each time you build a viz with the Sales field, it will use its revised default number format
In addition to Number Format, you can modify any of the other Default Properties—Comment, Color, Aggregation, Total using, etc.—and save those customizations in a .tds file
|
|
|
| | —————- | —————- | —————- |