Package homeTableau Desktop FoundationsStudy guide
Study guide

Chapter 123% of the exam45 min

Connecting to and Preparing Data

How Tableau Desktop connects to data with live connections or extracts, what .tds, .tdsx, .twb, .twbx and .hyper files hold, how to combine tables with relationships, joins and unions across one or more connections, and how to rename fields, alias values, assign geographic roles, change data types and set default properties.

By the end of this chapter you can

  • Create a live connection and an extract, and explain the differences between them
  • Save a data source's metadata in a .tds file, and build a data source that uses multiple connections
  • Add relationships, joins and unions, and explain when to use a join versus a relationship
  • Rename fields, alias values and assign geographic roles
  • Change a field's data type and its default properties

Live connections and extracts

Scenario: A regional sales team keeps orders in a cloud database and targets in a spreadsheet. The analyst needs dashboards that are fast to use on a laptop on the road, and a weekly view that is always up to date.

You connect from the Connect pane on the start page: To a File (such as Microsoft Excel, text files, JSON or spatial files), To a Server (such as a database or cloud application) or Saved Data Sources. Tableau then opens the Data Source page, where you add tables to the canvas, preview the data and choose between a live connection and an extract. Live is selected by default.

With a live connection, the workbook sends each query to the database or file and gets results back, so the data is always current and speed depends on the source. With an extract, the workbook queries a .hyper snapshot that is refreshed from the source, so it is fast, works offline and can be filtered or aggregated, but it is current only as of the last refresh. You choose Live or Extract at the top right of the Data Source page, and refreshes are full or incremental. Live connection Extract Workbook each query results Database or file always current; speed depends on the source Workbook .hyper snapshot refresh Database or file fast, offline, filtered or aggregated; current only as of the last refresh Choose Live or Extract at the top right of the Data Source page. Refresh: full or incremental.
Live connections query the source; extracts query a snapshot

Live connection Extract
How it works Sends queries straight to the data source every time the view changes Copies the data into a snapshot that Tableau queries instead
Freshness Always current As current as the last refresh
Speed Depends on the source system Often faster, especially for slow or busy sources
Offline Needs access to the source Works without a connection to the source
File None A .hyper file (older versions used .tde)
Good for Data that must be up to the minute, or a fast database Performance, working offline, sharing a subset of data

Creating an extract

  1. On the Data Source page, select Extract in the top-right corner. Select Edit to open the Extract Data dialog and choose options.
  2. Select a sheet tab. Tableau asks where to save the .hyper file and builds the extract.
  3. Save the workbook, so it keeps using the extract next time it opens.

You can also right-click the data source in the Data pane, or use the Data menu, and choose Extract Data.

The Extract Data dialog lets you make the extract smaller and faster:

  • Data storage: logical tables (the default) or physical tables.
  • Filters: keep only the rows you need, such as the last two years.
  • Aggregation: aggregate data for visible dimensions, and roll up dates to a level such as month.
  • Number of rows: all rows, a sample, or the top N rows.
  • Hide All Unused Fields: hidden fields are left out of the extract.

Extracts are updated with a refresh. By default an extract is fully refreshed, replacing all the data. An incremental refresh adds only new rows, identified by a field such as a date or an ID that always increases. It needs all rows and isn't available when the extract is aggregated.

Exam tip: "Always shows the latest data" points to a live connection. "Faster, offline, or a smaller subset of the data" points to an extract. An extract is a snapshot: it changes only when it is refreshed.

Saving data sources and using multiple connections

What each file type holds

Tableau file types. A .twb workbook holds sheets, dashboards, stories and connection information, but no data. A .twbx packaged workbook holds the .twb plus extracts, local files and images, so data is included. A .tds data source holds connection information and metadata such as renamed fields, calculations and aliases, but no data. A .tdsx packaged data source holds the .tds plus an extract or local files, so data is included. A .hyper file is an extract: a snapshot of the data. .twb workbook sheets, dashboards, stories, connection info no data .twbx packaged workbook .twb + extracts, local files, images data included .tds data source connection info + metadata (renames, calcs, aliases) no data .tdsx packaged data source .tds + extract or local files data included .hyper extract a snapshot of the data data
What Tableau's file types contain

File What it contains
.twb A workbook: its sheets, dashboards and stories and the connection information, but no data
.twbx A packaged workbook: the workbook plus local files such as extracts, Excel and text files, and images
.tds A data source: the connection information and metadata, such as default properties, calculated fields, groups, sets, bins and renamed fields, but no data
.tdsx A packaged data source: the .tds plus local files, such as an extract or a text file
.hyper An extract of the data

Saving a data source as a .tds means you, and anyone you share it with, can reconnect with all your preparation work already done, instead of renaming fields and creating calculations again. To save one, right-click the data source's name at the top of the Data pane, choose Add to Saved Data Sources, and pick .tds or .tdsx. Saved in the Datasources folder of your Tableau repository, it appears under Saved Data Sources in the Connect pane.

Data sources with multiple connections

One data source can combine tables from different connections, such as an Excel file and a SQL Server database:

  1. On the Data Source page, select Add in the left pane and connect to the second source.
  2. Drag a table from the new connection onto the canvas and relate or join it to a table from the first connection.

This adds a second connection, not a second data source: in the worksheet it works as one combined data source. Tableau colours the tables and columns to show which connection each comes from. Joining across connections is called a cross-database join. Some limits apply: unions must come from the same connection, and only calculations that every connection supports are available.

Data blending is different: it combines two separate data sources in a worksheet, one primary and one secondary, added with Data > New Data Source.

Exam tip: A .tds saves the work you did on the data source, not the data itself. If someone needs the data too, for example the extract, share a .tdsx or a .twbx.

Relationships, joins and unions

A data source has two layers:

The two layers of a Tableau data source. In the logical layer, Orders and Targets are connected by a relationship, a flexible line or noodle on Region, so each table keeps its own level of detail. Double-clicking Orders opens its physical layer, where Orders 2025 is unioned with Orders 2026 and joined to Order Lines, so they are merged into one table. Logical layer: relationships Orders Targets relationship ("noodle") on Region flexible: each table keeps its own level of detail double-click Orders Physical layer inside Orders: joins and unions Orders 2025 Orders 2026 union: rows stacked join: columns added Order Lines merged into one table
The logical layer relates tables; the physical layer merges them

  • The logical layer is the canvas you see first. Tables here are logical tables, connected by relationships, drawn as flexible lines sometimes called noodles.
  • The physical layer is inside each logical table. Double-click a logical table to open it, then join or union physical tables into it.

Relationships

A relationship describes how two tables are related, using one or more matching fields, such as Order ID, but doesn't merge them. The first table on the canvas is the base table; drag another table next to it and drop it when the noodle appears. You don't choose a join type: Tableau picks the right joins for each view, querying only the tables the view needs.

  • Each table keeps its own level of detail, so values aren't duplicated. A table of targets by region and a table of orders can be related without inflating sales.
  • Unmatched values are kept rather than dropped.
  • The matching fields must have the same data type, and you can't relate tables on geographic fields.
  • Performance options describe the cardinality (one or many) and referential integrity (some or all records match). They're optional: the defaults, many-to-many and some records match, are a safe choice.

Joins

A join combines two tables side by side into one table, matching rows on one or more fields.

The four join types, shown as overlapping circles for a left and a right table. An inner join keeps only rows that match in both. A left join keeps all left rows plus matches from the right. A right join keeps all right rows plus matches from the left. A full outer join keeps all rows from both. Unmatched values from the other table become nulls. A union stacks rows instead. Inner only rows that match in both Left all left rows, matches from right Right all right rows, matches from left Full outer all rows from both Unmatched values from the other table become nulls. A union stacks rows instead.
The four join types

Join type Keeps
Inner Only rows that match in both tables
Left All rows from the left table, plus matching rows from the right
Right All rows from the right table, plus matching rows from the left
Full outer All rows from both tables, matched where possible

Unmatched values from the other table become nulls. Because a join produces a single table at the most detailed level, values can be duplicated: joining orders to order lines repeats each order's shipping cost on every line, and summing it gives too large a total.

Unions

A union appends rows from tables that have the same structure, such as sales for January, February and March in separate sheets. The tables must come from the same connection, and fields are matched by name. Drag a table under another in the physical layer, or use a wildcard union to include every matching file or sheet automatically. Tableau adds fields such as Sheet and Table Name, showing where each row came from.

Join or relationship?

Use a relationship when Use a join when
Tables are at different levels of detail, such as orders and targets You need a specific join type, such as an inner join to keep only matching rows
You want Tableau to keep each table's detail and avoid duplicates You want to merge tables into one physical table at a single level of detail
You aren't sure: relationships are the default You're combining tables in the physical layer of one logical table

Exam tip: Relationships are the default and the safe choice for tables at different levels of detail. A join merges tables into one, so watch for duplicated values and dropped rows. A union stacks rows; a join adds columns.

Managing field properties

Once connected, you tidy fields so views are clear. These changes are saved with the data source and don't change the underlying data.

Right-click a field in the Data pane to change its properties. Rename changes the field name, for example Sub-Category to Product Type. Aliases change how a value shows, for example Central as Midwest. Geographic Role gives the field a globe icon and generated latitude and longitude. Change Data Type switches between string, number, date, Boolean and others. Default Properties set format, aggregation, colour and sort for every view. None of these changes the underlying data. Data pane right-click a field Rename Aliases… Geographic Role Change Data Type Default Properties the field's name: Sub-Category to Product Type how a value shows: Central as Midwest globe icon, generated latitude and longitude string, number, date, Boolean … format, aggregation, colour, sort for every view None of these changes the underlying data
Where to change a field's properties

Rename a field

Right-click a field in the Data pane and choose Rename, or double-click a column name on the Data Source page, for example Sub-Category to Product Type. The name in the data source doesn't change, and you can reset the original name later.

Alias a value

An alias changes how a value (member) of a dimension is displayed, without changing the data. Right-click the dimension in the Data pane, choose Aliases, and enter a new name for a member; Clear Aliases resets them. For example, show the value Central as Midwest, or M and F as Male and Female. Aliases work only for discrete dimensions: not for measures, dates or continuous dimensions.

Assign a geographic role

To map a field, give it a geographic role: in the Data pane, select the field's data type icon (or right-click it), choose Geographic Role and pick a role such as Country/Region, State/Province, City or ZIP Code/Postcode. The field's icon changes to a globe, and Tableau adds Latitude (generated) and Longitude (generated) to the measures in the Data pane, so its values can be placed on a map. Tableau assigns roles automatically to fields it recognizes.

Change a data type

Each field has a data type, shown by its icon:

Icon Data type
Abc String (text)
# Number (decimal or whole)
Calendar Date
Calendar with clock Date and time
T|F Boolean (true or false)
Globe Geographic values

To change it, select the type icon on the Data Source page or in the Data pane, or right-click the field in the Data pane and choose Change Data Type. For example, change a postal code stored as a number to a string so leading zeros aren't lost, or a date that was read as text to a date so you can drill down and use date calculations. Change data types before you create an extract.

Change default properties

Right-click a field and choose Default Properties to set how it appears every time it is used:

Property Applies to Example
Number Format Measures Currency with no decimals
Aggregation Measures Average instead of Sum
Total Using Measures How totals are calculated
Color Dimensions and measures Always show Technology in blue
Shape Dimensions Always use a star for Furniture
Sort Dimensions Always list High, Medium, Low in that order, in views and filters
Date Format Dates Show dates as 22/11/2026
Comment Any field A note shown in the field's tooltip

Exam tip: Rename is for field names; aliases are for values of a dimension. Default properties change a field everywhere it's used. Formatting a single view changes only that view.

Hands-on exercise

Prepare a sales data source

Connect, model and tidy a data source so it's ready to share.

Use a free Salesforce Developer Edition org — never a production org.

0 of 7 steps done

How to check your work: Your data source relates Orders and Returns rather than joining them, the alias and rename show in the view, Sales is formatted as currency everywhere, and you can explain what the .tds file contains and what it doesn't.

Domain quiz: Connecting to and Preparing Data

10 questions from the 47 in this domain, different each time and checked as you go. Anything you miss is saved to Mistakes review.

Questions
10
Time
Untimed
Feedback
After each answer

New questions each time you start, drawn from the bank, unseen ones first.

Exploring and Analyzing Data