Tableau for Beginners (session 2)

Tableau
beginner
Published

September 26, 2024

Warning

This is currently a draft version of the materials for this training session, and so may contain minor errors and inaccuracies.

Session materials
  • service use dataset .xlsx
  • GP practice dataset .xlsx

No feedback found for this session

Session outline

Visualisation overload!

  • we’re going to build several visualisations
  • we’ll use some tidied data for this - today is all about using data to do interesting things
  • next time, we’ll get into the data wrangling needed to sort that data out

Session files

Today’s visualisations

  • line graphs
  • filtering tools
  • numeric summaries of data
  • maps
  • column charts

The goal for this week

Filterable time-series dashboard Interactive map plus column graph

Data loading

  • this is a repeat of last week
Task
  1. go to https://public.tableau.com/app/
  2. select Web Authoring from the Create menu
    Web Authoring
  3. from the Data menu, select New Data Source
    Select `New Data Source
  4. drag and drop (or use the upload button) to add the s02_service_data.xlsx file
  5. drag the weekend_sh sheet into the data model

Service use data (weekend_sh)

Task
  • add a worksheet
    add a worksheet
  • go to that worksheet, and make a time-series graph from our data by dragging the Date and the Measure values fields to the shelf, and ensuring that data is set to Exact date:
    make a time-series graph
  • you might also switch off the values to avoid clutter
    switch off the values

Measure Value

  • Measure Values are a default calculated field derived from your data. You can think of it as containing all your numeric values
    • you’ll see that you can edit what appears in your graph - and do please remove the CNT(weekend_sh), which is just counting values
      Remove the CNT(weekend_sh) field
  • there’s also a Measure Names field which collects together all your measure names (like Excel column names)
    • when we add Measure Values to our graph, the Measure Names appear in the Filters area

Add a filter

Task
  1. drag the Date table into the Filters area. You’ll be asked to choose a way of filtering that data: select Range of Dates
    select Range of Dates in the filter
  2. that will produce a filter preview:
    filter preview
  3. add it to your graph by selecting Show filter
    Select Show filter
  4. now repeat for the Weekend table

A digression: icons, dimensions and measures

  • you might have noticed that your fields have coloured icons:
    Field icons
  • But there’s also a Tableau-specific pair of terms in play here: Dimensions and Measures
    • Dimensions are (usually) qualitative categories used to control the level of detail shown - like our Measure Names
    • Measures are quantitative values, which make up the values shown on our visualisations - like our Site B

Numeric summaries

Task
  1. start a new worksheet
    new worksheet
  2. our dimension for the summary will be Weekend - drag that to the Columns shelf
  3. our measure for the summary will be our several site columns - so (as before) add the Measure Names to the Rows shelf, and then the Measure Values to the Text mark
    Add the measure to the shelf
  4. do minor surgery:
    1. remove the count of weekend days
      remove weekend days count
    2. produce an average
      produce an average
    3. format the numbers appropriately
      format numbers
    4. improve the worksheet title
      change the worksheet title

Putting everything together

  • we’ll use a dashboard to assemble the plot, and the summary table
Task
  1. create a new dashboard from the row at the bottom of the screen
  2. double-click your Sheet 1 to add the graph
    Add Sheet 1 to the dashboard
  3. you can then drag your Sheet 2 into the blank space under the filters to add your summary table
    Add Sheet 2 to the dashboard
  4. you might also take the chance to rename your graph (and the dashboard as a whole) to something less drab:
    Rename as appropriate
  5. finally, hit publish and check your dashboard online in your profile

    published dashboard

GP practice size

Task
  1. select New Data Source from the menu
    Select New Data Source
  2. from the s02_gp_data.xlsx file, add gp_size_sh to your data and start a new worksheet
  3. drag the Latitude and Longitude fields to the column/row shelf. Avoid the Latitude (generated) and Longitude (generated) fields - they won’t work properly
  4. now drag the size List Size measure to the Size part of Marks
    Drag list size to the size area
    1. You might want to twiddle the Mark Size option to make sure your practices appear at the right scale
      Adjust mark size options
  5. drag the HB Name dimension to the Colour part of Marks
  6. finally, drag the Name field to the Detail part of Marks
About postcodes

Note that Tableau Public doesn’t play nicely with UK postcodes. It will recognise them, but they won’t plot properly on a map. British postcodes, properly speaking, don’t describe a location at all. Instead, they’re just code numbers for different buildings. Here, we estimate the position of each postcode by taking an average of the location of each building to which it refers. That’s known as a centroid, and this data contains latitude and longitude data for each postcode centroid, which is produced using the PostcodesioR R package.

Why not add both datasets at once?

  • if you add several datasets in one go, Tableau will automatically try to create relationships between them, and (in Tableau Public at least) it doesn’t seem possible to avoid this happening
  • in this case, we definitely don’t want this to happen. Our made-up service data, and our real GP data, don’t share anything in common
  • so adding a new data source once we’ve already done some work on the data is a hack-y way of giving you two independent data sources without pain

Adding a column graph of practice sizes

Task
  1. as usual, make a new sheet
  2. add:
    1. the Name field to the Columns shelf
    2. List Size to Rows
    3. HB Name to Colour
      drag HB Name to Colour
  3. then adjust the Sort option in Name to arrange your practices in descending order of size
    Find the Sort optionSort by field value
  4. you might also like to filter the Name field to just show the largest 50 practices
    Filter to largest 50 practices
  5. Finally, add both this worksheet and your map to a new dashboard page

Homework tasks

  1. Is there any relationship between practice size and SIMD2020 deprivation scores in the GP data? How could you show that relationship in a visual?
  2. Is there any month-to-month or seasonal change in the weekend service use data? How could you show that relationship in a visual?