Skip to main content

您的浏览器过小

请重新调整您的浏览器大小,以能够继续交互式学习。我们建议宽度至少为 900px。

Learning Objectives

After this unit, you’ll be able to:

  • Build a complex data model with multiple relationships.
  • Manually configure relationships.

Check: Connect Your Tableau Public Account

If you haven’t already, or if the playground has timed out, log in to your Tableau Public account in the Playground window to the right. If you don’t already have a Tableau Public account, sign up for one now, and be sure to activate your account before starting this interactive unit. You can find more detailed instructions in the first unit of this module.

Note

The playground resets if your Tableau Public login session expires or if you refresh the page before completing the unit. We recommend completing this unit in one sitting.

Add Complexity to the Data Model for Deeper Analysis

Time for more data! You're currently in the authoring environment for Tableau. You’ll come back here soon enough. For now, let's get back to configuring the data model. The first few steps may feel like a retread of the last unit, but it’s important to ensure you’re well versed in the data model.

  1. Click the New Data Source icon in the toolbarnew data source icon
  2. On the Files tab, click Upload from computer. If you’re having trouble finding the zip, you can click here to download it again.
  3. Upload Episodes.csv.
  4. Click the + icon next to Connections in the left pane and upload Seasons.csv.
  5. From the left pane under Files, drag Seasons.csv to the canvas.
  6. Now for more data. Click the + icon next to Connections to upload ChallengeBakes.csv.
  7. Drag the ChallengeBakes.csv table onto the canvas. Again, make sure the noodle is between Episodes.csv and ChallengeBakes.csv.
    • That is, ChallengeBakes.csv shouldn’t come off the back of Seasons.csv. If a table ends up in the wrong place, hover over the table, click the caret to open the dropdown menu, then remove it and try again. Or there’s always the Undo button in the toolbar.
    • Make sure you're bringing the table from the Files area of the left pane, not trying to drag out the connection information.

Uh oh! The noodle is broken.

Create a Manual Relationship

Sometimes, Tableau can't automatically create the relationship for you, so you have to do it yourself.

  1. Make sure the broken noodle is selected.
  2. In the Preview pane, open the dropdown Select a field under the header for Episodes.csv.
  3. Select Episode. Hover at the top of the toolbar in the middle of the screen to bring up the sizing handle if you need to resize the bottom pane.
  4. Open the Select a field dropdown under ChallengeBakes.csv.
  5. Select Episode (ChallengeBakes.csv).

This is a relationship clause between the Episode field in the Episodes table and the Episode (ChallengeBakes.csv) field from the ChallengeBakes table.

Add Relationship Clauses

If you leave it like this, though, you'd combine every episode 3’s episode information (regardless of season) with every episode 3’s challenges (regardless of season). What you want is to combine information for s1e3 with information for s1e3, s2e3 with s2e3, and so on. You need a second relationship clause on Season to handle this. Create that second relationship clause to ensure the seasons properly align.

  1. In the Preview pane, click the Add more fields button to add a relationship clause.
    • Hover at the top of the toolbar in the middle of the screen to bring up the sizing handle if you need to resize the bottom pane.
  2. From the Select a field dropdown under Episodes.csv, scroll down and choose Season. (Make sure you don't use the Season Episode field.)
  3. From the Select a field dropdown under ChallengeBakes.csv, choose Season (ChallengeBakes.csv).

This is a relationship clause between the Season field in the Episodes table and the Season field in the ChallengeBakes table. Now both sets of field values (Episode and Season) will need to match for those tables to be related.

  1. Add the Bakers table. Click the + icon next to Connections and upload Bakers.csv.
  2. Drag the Bakers.csv table to the canvas to the right of ChallengeBakes.csv.
    • Drag the file from the Files area of the left pane, not the Connections area.
    • Make sure the noodle connects ChallengeBakes.csv and Bakers.csv
  3. Set up the relationship clause between ChallengeBakes.csv and Bakers.csv. It should be Baker = Baker (Bakers.csv).
  4. Add the Outcomes table. Upload Outcomes.csv.
  5. Drag out the Outcomes table and relate it to the ChallengeBakes.csv table.
    • ChallengeBakes.csv should now have two tables coming off of it, both Bakers.csv and Outcomes.csv
  6. Verify the relationship clause is Season Episode = SeasonEpisode (Outcomes.csv).
    • This is a combined field that has the SeasonEpisode information together, such as s2e3—a different solution than relating on Episode and Season independently.

That's it. That’s your data model. From here on out, we'll refer to the data source, since the model refers more to the table diagram. (Note: those two links are fairly technical. Only explore them if you're comfortable with the content. You don't need any of that info to keep going here!)

Give Your Data Source a Name

There's one last housekeeping step. It's always good to name data sources something useful. Let’s call this GBBO for Great British Bake Off (in homage to the original, British name).

  1. At the top of the canvas, click where it says Episodes.csv+ (Multiple Connections) and enter GBBO instead.

Nice work!

Resources