Đại học Kinh tế Quốc dân – National Economics UniversityMICRO4ASIA
🏆 Arena
Sign inSign up
MICRO4ASIAThe six micro-credentials

Courses are delivered on the Limio learning platform. Limio

← Data Visualization in Business

You are viewing a public preview

Sign in to save your progress, do assignments, join discussions and get feedback.

Sign in
Module 2 — Data Connection and Preprocessing in Tableau

2.2 · Connecting Data with Tableau

Print / Save as PDF

In this lesson

Tableau Desktop and Tableau Public; the interface and data pane; connecting Excel, CSV, database and supported cloud sources; reviewing data structure and field roles; dimensions and measures; discrete and continuous fields.

Learning outcomes

  • LO.3: Organize tabular data, identify fields and data types, set keys and relationships, and connect suitable data sources.
  • LO.5: Use Tableau Desktop and Tableau Public to connect data, organize fields and build visualizations.

The lecture slides for this lesson are below.

Study notes

By the end of this lesson you can:

  • Describe the products of the Tableau ecosystem and choose between Tableau Desktop and Tableau Public.
  • Navigate the Tableau interface: data source page, worksheets, dashboards, stories, panes, shelves and cards.
  • Choose between a live connection and an extract.
  • Distinguish a field's data type, geographic role and field role (dimension or measure, discrete or continuous).
  • Explain the difference between a relationship, a join and a union in Tableau.

Key idea: Connecting data is more than opening a file. You decide how Tableau reads the data (live or extract), how tables combine (relationship, join or union) and what role each field plays, and these choices determine whether your later numbers are right.

The Tableau ecosystem

  • Tableau Desktop: the main authoring tool for connecting to data, analysing and building workbooks.
  • Tableau Public: a free platform for sharing. The free Tableau Public app saves workbooks to your public online profile, where anyone can see them and the data behind them. Never publish personal, confidential or sensitive business data there.
  • Tableau Prep Builder: designs flows that connect, clean, combine and transform data (lesson 2.3).
  • Tableau Prep Conductor: publishes, schedules and monitors Prep flows on Tableau Server or Tableau Cloud.

Installing Tableau means checking system requirements, downloading the right package, installing and activating (or signing in for Tableau Public). Afterwards, create a workbook and test a sample connection.

The working interface

A workbook contains four kinds of sheet:

  • Data Source page: connect to data and inspect it.
  • Worksheet: one view (chart or table).
  • Dashboard: several worksheets and interactive objects on one canvas.
  • Story: a sequence of views or dashboards that tells a data story.

On a worksheet you work with the Data pane (fields) and Analytics pane (reference lines, trend lines, forecasts, clusters), the shelves and cards (Columns, Rows, Filters, Pages, Marks), the view itself, the sheet tabs and the status bar, which shows counts such as the number of marks.

Data connections

Tableau connectors fall into three groups: files (Excel, text/CSV, JSON, PDF, spatial and statistical files), databases (for example Microsoft SQL Server, MySQL, PostgreSQL, Oracle) and cloud services.

Live versus extract:

LiveExtract
What happensTableau queries the source directly each timeTableau stores a snapshot (a .hyper file)
FreshnessAlways currentCurrent as of the last refresh
PerformanceDepends on the source systemUsually fast
Use whenData change often and the database is fastLarge files, slow sources, offline work, publishing to Tableau Public

For Excel or CSV, check the sheet names, whether the first row holds headers, the field names, the sample rows in the data preview and the detected data types. For a database, check the server, database name, credentials and drivers.

Data type, geographic role and field role

These are three separate properties of a field:

  • Data type: how values are stored, such as String (Abc icon), Number (#), Date, Date & Time, Boolean.
  • Geographic role: tells Tableau that a field contains places (Country/Region, State/Province, City, Postal Code) so it can generate latitude and longitude for maps. If some names are not recognised, Edit Locations lets you match them manually.
  • Field role: dimension (qualitative, used to group and slice) or measure (quantitative, aggregated, for example SUM). Each field is also discrete (separate values, shown as headers, blue) or continuous (an unbroken range, shown as an axis, green).

Tableau guesses roles from data types, so numeric identifiers often land among the measures. You can change any of these properties in the Data pane by right-clicking a field.

Relationships, joins and unions

  • Relationship (the default when you drag a second table onto the canvas): a logical, flexible link based on matching fields. Each table keeps its own level of detail, and Tableau chooses how to combine the tables for each view, using only the tables that view needs. This avoids most duplication when tables have different grains.
  • Join: physically merges tables into one table on common fields (inner, left, right, full outer). You create joins in the physical layer by double-clicking a table on the canvas. Joins can duplicate rows if the grains differ.
  • Union: appends rows from tables with the same structure.

Worked example

A sales analyst connects to Sales_Data.xlsx and must decide how to set it up for a monthly dashboard that compares 2025 sales with the regional targets.

  1. Live or extract? The source is an Excel file updated once a month. An extract gives fast performance and is required for Tableau Public anyway. Refresh the extract after each monthly update.
  2. Combine tables. Orders, Customer, Product and Targets have different grains (order line, customer, product, Region × month). Use relationships: Orders–Customer on Customer ID, Orders–Product on Product ID, and Targets related to Customer on Region. Because relationships keep each table's grain, the targets are not repeated for every order line, which is exactly what an ordinary join would do.
  3. Field roles. Row ID is numeric, so Tableau may treat it as a measure; convert it to a dimension because adding IDs is meaningless. Discount is a measure, but think about aggregation: averaging discount rates is usually more meaningful than summing them.
  4. Geographic roles. Set Province to State/Province so the dashboard can show a map.
  5. Validate. Put SUM(Sales) on Text and compare the total with the source file before building any chart.

Common mistakes

  • Publishing sensitive data to Tableau Public. Everything saved there is public.
  • Using a join where a relationship fits. Joining tables of different grains duplicates values and inflates totals.
  • Leaving identifiers as measures. SUM(Row ID) appears in the view but means nothing.
  • Confusing colour with role. Blue and green show discrete and continuous, not dimension and measure; a dimension such as a continuous date can be green.

Summary

  • Desktop is for authoring, Public for public sharing, Prep for preparing data, Prep Conductor for scheduling flows.
  • A workbook holds data source, worksheet, dashboard and story sheets.
  • Live connections are always current; extracts are fast snapshots.
  • Data type, geographic role and field role are separate properties you should check after connecting.
  • Relationships keep each table's grain; joins merge tables physically; unions stack rows.

Flashcards · Connecting Data with Tableau

9 words
WordMeaningExample
  • Tableau Public

    A free platform that saves workbooks to a public online profile, visible to anyone.

    Never publish customer names or confidential sales there.

  • Tableau Prep Conductor

    Publishes, schedules and monitors Tableau Prep flows on Tableau Server or Tableau Cloud.

    Run the cleaning flow every night at 2 am.

  • Live connection

    Tableau queries the data source directly, so views always show current data.

    Live connection to the sales database.

  • Extract

    A stored snapshot of the data (.hyper file) that is fast and refreshed on demand or on a schedule.

    Extract of Sales_Data.xlsx for Tableau Public.

  • Dimension

    A qualitative field used to group, slice and set the level of detail of a view.

    Region, Category, Order Date.

  • Measure

    A quantitative field that Tableau aggregates, for example with SUM or AVG.

    SUM(Sales), AVG(Discount).

  • Discrete vs continuous

    Discrete fields show separate values as headers (blue); continuous fields form an axis (green).

    YEAR(Order Date) blue headers; MONTH continuous green axis.

  • Geographic role

    A property that tells Tableau a field contains places so it can draw maps.

    Province set to State/Province.

  • Relationship

    A logical link between tables on matching fields that keeps each table's own level of detail.

    Orders related to Customer on Customer ID.

Practice in Tableau — Lab 2A: Connect and combine the sales data

Both files are attached to the Course Overview lesson: Sales_Data.xlsx (clean) and Sales_Data_Raw.xlsx (raw, for Tableau Prep). data_dictionary.md explains every field. Use Tableau Public (free) or Tableau Desktop.

  1. Connect. Connect → Microsoft Excel → Sales_Data.xlsx. Drag Orders onto the canvas. Check: 12 fields and 4,770 rows (2,600 distinct orders; one row is one product line of an order).
  2. Inspect field roles. Find which fields Tableau treats as dimensions and which as measures, and which are discrete or continuous. Change Row ID to a dimension: it is an identifier, not a number to add up.
  3. Relate the tables. Drag Customer and Product next to Orders. Tableau creates relationships on Customer ID and Product ID; check the matching fields.
  4. Geographic roles. In Customer, set Province to Geographic Role → State/Province and Country to Country/Region. If a province is not recognised, use Map → Edit Locations to match it.
  5. First view. On a worksheet, drag Sales to Text. Check: total sales 2,659,423. Add Category to Rows. Check: Technology 1,294,817, Furniture 851,001, Office Supplies 513,604.
  6. Join versus relationship. In a new data source, open the Customer table, double-click it to open the physical layer, add Orders and choose a left join on Customer ID. Check: 4,784 rows: 14 of the 240 customers have never ordered, so they appear once with empty order fields. Explain why an inner join returns 4,770 rows instead.