Study interactive :: Progress tools open in the Study Hub reader.

Tableau

This guide covers Tableau for data visualization and dashboard creation in data science.

Table of Contents


Introduction to Tableau

What is Tableau?

Tableau is a powerful data visualization tool that allows you to create interactive dashboards and reports without coding. It's widely used in business intelligence and data analysis.

Why Tableau?

Advantages:

Use Cases:

Tableau Products

  1. Tableau Desktop: Create visualizations (paid)
  2. Tableau Public: Free version (public data only)
  3. Tableau Server: Share dashboards (enterprise)
  4. Tableau Online: Cloud-based sharing

Getting Started

Installation

  1. Download Tableau Desktop or Tableau Public
  2. Install the software
  3. Launch Tableau

Tableau Interface

Key Components:

Basic Workflow

  1. Connect to Data: Import your data source
  2. Explore Data: Understand your fields
  3. Create Visualization: Drag fields to shelves
  4. Format: Customize appearance
  5. Create Dashboard: Combine multiple visualizations
  6. Publish: Share your work

Connecting to Data

Excel/CSV Files

  1. Click "Connect to Data"
  2. Select "Excel" or "Text file"
  3. Choose your file
  4. Drag sheet to canvas

Database Connections

SQL Server:

  1. Connect to SQL Server
  2. Enter server details
  3. Select database
  4. Write SQL query or select tables

MySQL:

  1. Connect to MySQL
  2. Enter connection details
  3. Select database and tables

Other Sources:

Data Preparation

Data Types:

Changing Data Types:

Renaming Fields:


Basic Visualizations

Bar Chart

  1. Drag dimension to Columns
  2. Drag measure to Rows
  3. Tableau creates bar chart automatically

Example:

Line Chart

  1. Drag date to Columns
  2. Drag measure to Rows
  3. Tableau creates line chart

Example:

Scatter Plot

  1. Drag measure to Columns
  2. Drag measure to Rows
  3. Drag dimension to Color (optional)

Example:

Pie Chart

  1. Drag dimension to Columns
  2. Drag measure to Rows
  3. Click "Show Me" → Pie Chart

Heatmap

  1. Drag dimension to Columns
  2. Drag dimension to Rows
  3. Drag measure to Color
  4. Adjust color intensity

Advanced Visualizations

Dual Axis Charts

Combine two measures on different axes:

  1. Create line chart with first measure
  2. Drag second measure to Rows
  3. Right-click second measure → Dual Axis
  4. Synchronize axes if needed

Calculated Fields

Create custom calculations:

  1. Right-click Data pane → Create Calculated Field
  2. Enter formula:
    [Sales] - [Cost]
    
  3. Use in visualizations

Parameters

Create interactive controls:

  1. Right-click Data pane → Create Parameter
  2. Set data type and range
  3. Use in calculated fields
  4. Show parameter control

Table Calculations

Running Total:

  1. Right-click measure → Quick Table Calculation
  2. Select "Running Total"

Percent of Total:

  1. Right-click measure → Quick Table Calculation
  2. Select "Percent of Total"

Level of Detail (LOD) Expressions

Fixed LOD:

{FIXED [Region] : SUM([Sales])}

Include LOD:

{INCLUDE [Category] : SUM([Sales])}

Exclude LOD:

{EXCLUDE [Category] : SUM([Sales])}

Calculations and Functions

Basic Calculations

Mathematical:

[Sales] + [Profit]
[Sales] * 1.1  // 10% increase
[Sales] / [Quantity]

String:

[First Name] + " " + [Last Name]
UPPER([Category])
LEFT([Product], 5)

Date:

YEAR([Order Date])
MONTH([Order Date])
DATEDIFF('day', [Start Date], [End Date])

Logical Functions

IF Statement:

IF [Sales] > 1000 THEN "High"
ELSEIF [Sales] > 500 THEN "Medium"
ELSE "Low"
END

CASE Statement:

CASE [Region]
WHEN "North" THEN "N"
WHEN "South" THEN "S"
ELSE "Other"
END

Aggregation Functions

SUM([Sales])
AVG([Sales])
COUNT([Orders])
MAX([Sales])
MIN([Sales])
STDEV([Sales])

Dashboards and Stories

Creating Dashboards

  1. Click "New Dashboard" tab
  2. Drag sheets to dashboard
  3. Arrange and resize
  4. Add filters and actions

Dashboard Objects

Text:

Images:

Web Page:

Filters

Quick Filters:

  1. Right-click field → Show Filter
  2. Customize filter type
  3. Apply to all sheets or specific sheets

Context Filters:

Actions

Filter Actions:

Highlight Actions:

Stories

Create narrative presentations:

  1. Click "New Story" tab
  2. Add sheets to story points
  3. Add captions
  4. Navigate through story

Tableau vs Python Visualization

When to Use Tableau

Advantages:

Best For:

When to Use Python (Matplotlib/Seaborn/Plotly)

Advantages:

Best For:

Comparison Table

Feature Tableau Python
Learning Curve Easy Moderate
Cost Paid (Desktop) Free
Customization Limited Full
Reproducibility Manual Code-based
Sharing Easy Requires hosting
Integration Limited Excellent

Best Practices

Design Principles

  1. Keep it Simple: Don't overcrowd dashboards
  2. Use Color Wisely: Consistent color schemes
  3. Clear Labels: Descriptive titles and axis labels
  4. Appropriate Charts: Choose right chart type
  5. Mobile-Friendly: Consider different screen sizes

Performance

  1. Data Extraction: Use extracts for large datasets
  2. Filters: Use context filters
  3. Calculations: Optimize calculated fields
  4. Data Source: Connect efficiently

Organization

  1. Folders: Organize fields in folders
  2. Naming: Use clear, consistent names
  3. Documentation: Add descriptions to fields
  4. Version Control: Save multiple versions

Practice Exercises

Exercise 1: Sales Dashboard

Create a dashboard showing:

Exercise 2: Customer Analysis

Analyze customer data:

Exercise 3: Financial Report

Create financial dashboard:


Additional Resources

Official Resources:

Tutorials:

Alternatives:


Try next: Build one Tableau (or similar) view that answers a single business question.