Hi All,

 

in this blog post, I will show you how to create a whale curve in Tableau. A whale curve is a similar graph as a Pareto chart however the whale curve is easier to interpret. You can easily detect which of your customers are the most/least profitable ones. I've got the question to create a whale curve in Tableau from a client and the results looked cool. Et voila, a new topic for a blog.

Step 1:

Drop Customer Name on detail and count distinct the Customer Name in Columns.

Step 1

Step 2:

Add a table calculation on the count distinct of Customer Name. The table calculation should be a running total running along the Customer Name. Also perform a secondary calculation that is the percent of total summarizing along Customer Name.

Step 2

Step 3:

Drop Profit on the Rows shelf.

Step 3

Step 4:

Add the same table calculation as in step 2 on the Profit tile.

Step 4

Step 5:

You should get a similar result.

Step 5

Step 6:

Sort the Customer Name on detail in a descending way using the sum of profit.

Step 6

Step 7:

Create a parameter called "Set Treshold" as float going from 0.1 to 1 using a step size 0.1.

Step 7

Step 8:

Create a calculated field called "Set Treshold (Calc)" using following fomula:

iif(running_sum(countd([Customer Name])) / WINDOW_SUM(countd([Customer Name])) <= [Set Treshold],
running_sum(countd([Customer Name])) / WINDOW_SUM(countd([Customer Name])),
Null)

Step 8

Step 9:

Dual axis "Set Treshold (Calc)" on the Columns shelf and synchronize the axis. Make sure Set Treshold (Calc) is calculated using Customer Name.

Step 9

Step 10:

You should get a similar result.

Step 10

Step 11:

Set the graph type to area.

Step 11

Step 12:

Remove the tile on detail called "Measure Names". Your graph should look like this.

Step 12

Step 13:

Add a reference line using the Set Treshold parameter.

Step 13

Step 14:

Create a calculated field called "Label" using following formula:

running_max(iif(running_sum(countd([Customer Name])) / WINDOW_SUM(countd([Customer Name])) <= [Set Treshold],
running_sum(sum([Profit])) / WINDOW_SUM(sum([Profit])),
Null))

Step 14

Step 15:

Create a new sheet and drop Label and Customer Name on detail. Make sure Label is calculated using Customer Name.

Step 15

Step 16:

Create a new calculated field called "Last" using following formula:

LAST()=0

Step 16

Step 17:

Drop Last onto the filter shelf and filter on True. Make sure Last is calculated using Customer Name! Also drop Set Treshold on detail. You should get a similar result.

Step 17

Step 18:

Put the 2 sheets together on a dashboard. You should get a similar result. Click on the graph to go to the interactive version and download the Tableau Workbook.

Step 18

That was it folks! I Hope this was useful.

Happy Analyzing!

Author
Matthew Miller

Matthew Miller

Co-Founder of Biztory.

Read more articles of this author
Let's discuss your data challenges

Join our community of data enthusiasts

Get industry insights, expert tips and Biztory news sent straight to your inbox with our monthly newsletter.