Introduction

For this dashboard week challenge, we had to use data relating to shark attacks in the past century to create a dashboard. We had a morning to create and present a dashboard and so time-boxing was crucial for this challenge. In my spare time after the dashboard week, I have added additional visualizations to the chart to practice some index() and last() table calculations.

Data/Story Preparation

The data provided turned out to be quite messy and posed a significant challenge. To ensure there was enough time to build a dashboard, we needed to dedicate just enough time to data cleaning without going overboard. The cleaning process we employed included:

  1. Matching age formats use the datetime tool
  2. Categorising activities using true/false and “contains” formulae
  3. Categorising times after regex
  4. Categorising species of shark

Due to the constraints of time, I chose an open story like causes of shark attacks with more focus on dashboard actions. The workflow is shown below:

Tableau Dashboard

The dashboard is presented below:

The most interesting feature is the shark icons on the right. These are shown when you hover over a map icon as seen here. To create this, it requires a set action where “on hover”, the action will add that country to a set.

Then the calculation is created as such and used in conjunction with a simple dual axis chart of total shark attacks.

To understand this formula, I’ll break it down into how I worked my way to this point:

  1. Generally, to create a frequency histogram by points, we’d put a index() on an axis and split it by the level of detail as such:
  2. However, we need to incorporate a set action and so on hover, we add the country to the set. When this set action is activated, the Record ID’s related to that set are now added.
    We can use this calculation as our level of detail when the action is activated
  3. For the dual-axis graph, To understand why we can’t use index() In the calculation;

    these are the definitions:

    last() → It will assign 0 to the last row in the partition and increases the number as it goes up. (0,1,2,3 from the last row in the partition). It returns the number of steps to be taken to reach the last row from the current row.

    index() → It will return the index of the current row in the partition.

    The index() will be 1 for each row level in this calculation as we aren’t grouping by country and maintaining the row structure. In 1., we can use index() because it is grouped by a year.
    By using last(), it can be thought of as something similar to SUM(Index()). (Note this won’t work because you can not aggregate Index() which is an aggregation.

     

This is a complicated process but it produces a neat little visualization. Thank you for your time 😊

 

Nam Nguyen
Author: Nam Nguyen