Lab 04 Visualization in Tableau
URBAN 520 Quantitative Methods in Urban Design and Planning
In this lab, we are going to use Tableau, a business intelligence and analytics platform that allows users to create interactive visualizations and dashboards to understand data. It provides free access to students. Please try to download Tableau for Students in advance.
In this lab, we will use transit data from the Federal Transit Administration’s National Transit Database (NTD). Every U.S. transit agency that receives federal funding reports its service and ridership to the NTD. We prepared two files from two NTD tables (download them here):
- ntd_monthly_ridership.csv: monthly ridership of 626 agencies, January 2015 to December 2025, from Complete Monthly Ridership (with Adjustments and Estimates). One row is one agency, one mode, one type of service, in one month.
- ntd_agencies.csv: one row per agency, with its location and service area, from 2024 NTD Annual Data - Reporter Agency Information.
The two files share the column NTD ID.
Click to view the full data dictionary
ntd_monthly_ridership.csv
- NTD ID (string) — The agency’s NTD
identifier; keeps leading zeros (e.g., 00001).
- Agency (string) — Legal name as reported
(e.g., King County).
- Agency Common Name (string) — The name
people use (e.g., King County Metro).
- State (string) — Two-letter state.
- Urbanized Area (string) — Census urbanized
area (e.g., Seattle–Tacoma, WA).
- Mode Code, Mode (string)
— NTD mode code and name (e.g., LR, Light Rail).
- Mode Group (string) — Bus, Rail, or
Ferry.
- Type of Service (string) — Directly
Operated, or Purchased Transportation (by contract, taxi, or
ride-hailing).
- Service Status (string) — Active, or
Inactive if the agency no longer runs this mode.
- Reporter Type (string) — Full Reporter
(large agencies), Small Systems Reporter, etc.
- Month (date) — First day of the month
(e.g., 2025-03-01).
- Unlinked Passenger Trips (integer) —
Boardings: a rider who transfers once counts twice.
- Vehicle Revenue Miles, Vehicle Revenue
Hours (integer) — Service supplied: miles and hours
vehicles run while carrying or available to carry riders.
- Vehicles in Peak Service (integer) — Vehicles operated in maximum service.
ntd_agencies.csv
- NTD ID (string) — Joins to the monthly
file.
- Agency Name, Agency Common Name
(string) — Legal and common names.
- Organization Type, Reporter Type
(string) — Kind of agency and how it reports.
- City, State, Zip
Code (string) — The agency’s mailing address.
- Latitude, Longitude
(numeric) — Coordinates of that address (the headquarters, not
the service area).
- Urbanized Area (string) — The agency’s
primary urbanized area.
- Urbanized Area Population, Sq
Miles, Density (numeric) — Census
figures for that urbanized area.
- Service Area Population, Service Area Sq
Miles (numeric) — The population and area the agency
serves.
- URL (string) — The agency’s website.
We are going to build an interactive dashboard on how transit ridership in the U.S. has changed since 2015: the collapse in 2020 and the recovery after. The goal is not only to display information but also to enable users to explore, filter, and compare different variables dynamically. After that, we will publish online through Tableau Public as well as your GitHub page. Also, we will continue working on dashboard in next lab, so do not worry if some functions you want do not show in this lab. The final results will be like this:
The Tableau Workspace
- A. Workbook name. A workbook contains sheets. A sheet can be a worksheet, a dashboard, or a story. For more information, see Workbooks and Sheets.
- B. Cards and shelves - Drag fields to the cards and shelves in the workspace to add data to your view.
- C. Toolbar - Use the toolbar to access commands and analysis and navigation tools.
- D. View - This is the canvas in the workspace where you create a visualization (also referred to as a “viz”).
- E. Click this icon to go to the Start page, where you can connect to data. For more information, see Start Page.
- F. Side Bar - In a worksheet, the side bar area contains the Data pane and the Analytics pane.
- G. Click this tab to go to the Data Source page and view your data. For more information, see the Data Source Page.
- H. Status bar - Displays information about the current view.
- I. Sheet tabs - Tabs represent each sheet in your workbook. This can include worksheets, dashboards, and stories. For more information, see Workbooks and Sheets.
Key Steps
Connect to Data
- In the Connect pane, click Text File, select ntd_monthly_ridership.csv, and click Open.
- Drag ntd_agencies.csv from the left panel onto the canvas next to the first table. Tableau draws a line between them, a relationship; check that both sides use NTD ID.
- Change data types in the data source page: NTD ID (in both tables) and Zip Code → String (so 00001 keeps its zeros), Month → Date.
- (Optional) Change column labels for readability, e.g., Unlinked Passenger Trips → Trips (this won’t rename your local file).
- Concepts: Dimensions
and Measures
- Dimensions contain qualitative values (such as names, dates, or geographical data).
- Measures contain numeric, quantitative values that you can measure.
- You can re-categorize a dimension as a measure or vice versa.
- Concept: Relationship. Each table keeps its own rows: one row per agency in one, one row per agency-mode-month in the other. Tableau matches them on NTD ID only when a view needs both.
Global Formatting
- Adjust global font, font size, alignment, etc., under Format → Workbook (Format at the Workbook Level).
Map
- Drag Longitude → Columns and Latitude → Rows (from ntd_agencies). See Mapping in Tableau.
- Drag Agency Common Name → Marks → Detail to get one point per agency.
- Drag Unlinked Passenger Trips → Marks → Size (Maps that Show Quantitative Values).
- Show one year: drag Month → Filters → Years → check 2025 (Filter Data from Your Views).
- Customize the map background: Map → Map Layers → Style (Customize How Your Map Looks).
- Add Tooltip: drag Agency Common Name, City, and Unlinked Passenger Trips to Marks → Tooltip (the Marks card).
- Rename the worksheet to Map.
Total Trips
- Drag Unlinked Passenger Trips → Columns (SUM by default). Try right-click → Measure → Average to see how the aggregation changes, then set it back to Sum.
- Filter Month to 2025 as in the map.
- Add Mark Labels to show the value, and hide the X-axis (right-click → Show Header off).
- Format the number in default properties: right-click Unlinked Passenger Trips → Default Properties → Number Format → Number (Custom) → Display Units: Billions (Format Numbers).
- Rename to Total Trips (2025).
Trips by Mode
- Drag Mode → Rows and Unlinked Passenger Trips → Columns; filter to 2025.
- Sort descending, label each bar, and hide the X-axis.
- Try another aggregation: drag NTD ID → Columns → right-click → Measure → Count (Distinct) to count the agencies that run each mode.
- Rename the worksheet and add a short descriptive text in a text box.
Who Runs the Service
- Create a Group: right-click Type of Service → Create → Group, select the three Purchased Transportation values, click Group, and name it Contracted. Name the new field Operator.
- Drag Mode Group → Rows and Unlinked Passenger Trips → Columns; filter to 2025.
- Drag Operator → Color in the Marks card.
- Customize the color palette.
- Rename the worksheet and add notes.
Top 10 Agencies
- Drag Agency Common Name → Rows and Unlinked Passenger Trips → Columns; filter to 2025.
- Sort descending and add mark labels.
- Keep the top ten: drag Agency Common Name → Filters → Top tab → By field: Top 10 by Unlinked Passenger Trips, Sum (Filter Data from Your Views).
- Look at the first bar. What does one agency carrying more than a third of all U.S. trips do to the rest of the chart?
- Rename the worksheet.
Ridership Over Time
- Drag Month → Columns, right-click it, and choose the second Month (with the year, e.g., May 2015). The pill turns green: a continuous date, which draws a line. See also Change Date Levels.
- Drag Unlinked Passenger Trips → Rows and Mode Group → Color.
- Right-click the low point in April 2020 → Annotate → Point and write a short note (Add Annotations).
- Concept: blue pills are discrete (separate headers), green pills are continuous (an axis); see Dimensions and Measures, Blue and Green.
- Rename to Ridership Over Time.
Trips per Revenue Hour
- Create a calculated
field: Analysis → Create Calculated Field, name it
Trips per Revenue Hour:
SUM([Unlinked Passenger Trips]) / SUM([Vehicle Revenue Hours]) - Drag Mode → Rows and Trips per Revenue Hour → Columns; filter to 2025; sort descending.
- Why SUM divided by SUM: the ratio of the totals, not the average of each row’s ratio (Lecture 5, Reduce: aggregate).
Dashboard
- Click New Dashboard (+) (Create a Dashboard).
- Set min and max dashboard size (Size and Lay Out Your Dashboard).
- Drag your worksheets into the layout: Total Trips on top, Map and Ridership Over Time in the middle, the bar charts at the bottom.
- Use Text Box to add a title, a description, and the data source citation (Federal Transit Administration, National Transit Database).
- Apply consistent background color and font.
Interactivity
- Right-click filters (e.g., State, Mode Group) → Show Filter.
- Change filter type to dropdown or slider as needed.
- Make filters affect all worksheets (Apply to Worksheets → All Using This Data Source; see Apply Filters to Multiple Worksheets).
- The 2025 year filter should not reach Ridership Over Time: apply it with Apply to Worksheets → Selected Worksheets and leave that sheet unchecked.
- Click a chart in the dashboard and click its funnel icon (Use as Filter): selecting an agency on the map now filters the other charts (Filter Actions).
- Test interactivity — selecting a state should update all charts.
Publish
- Save to Tableau Public (Save
Workbooks to Tableau Public)
- Click File → Save to Tableau Public
- Log in with your Tableau Public account (create one if needed).
- Wait for the upload to finish — Tableau will open your dashboard in the browser.
- Embed to your webpage (Embed
Views into Webpages)
- On your Tableau Public page, click Share (top right).
- Copy the Embed Code.
- Paste it into your website’s HTML or Markdown.
- Save as Packaged Workbook (.twbx) (Packaged
Workbooks)
- Go to File → Export Packaged Workbook
- Name your file (e.g., NTD_Ridership_Dashboard.twbx).
- Click Save.
Hierarchy
- In the Data pane, drag Urbanized Area onto State to create a hierarchy, then drag Agency Common Name into it — order matters (State, then Urbanized Area, then Agency).
- Drag the hierarchy to Rows and Unlinked Passenger Trips to Columns.
- Click + and − on the headers to drill down and up; sort descending if needed.
Worksheet, Dashboard, Story
- A worksheet contains a single view along with shelves, cards, legends, and the Data and Analytics panes in its sidebar. For details on the worksheet workspace, see The Tableau Workspace.
- A dashboard is a collection of views from multiple worksheets. The
Dashboard and Layout panes are available in its sidebar. For more
details about creating dashboards, see Dashboards.
- What is changed in the dashboard will affect the worksheet
- A story contains a sequence of worksheets or dashboards that work
together to convey information. The Story and Layout panes are available
in its side bar. For more details about creating stories, see Stories
- What’s changed in the story will not affect the worksheet or dashboard