<< Back

Five Tableau Tips – September Edition

Five Tableau Tips – September Edition

How to…in Tableau

Welcome to the September edition of the Tableau Five Tips blog post. It contains some of the questions that I have been asked this month. All of them started with: ‘How to…in Tableau’. 

Want to learn everything about Tableau and Alteryx from the team at The Information Lab? 

Register to our Free Events here also visit our learning path page here.

In need of our Consulting expertise or Licencing offerings? Write to info@theinformationlab.co.uk for customised learning and support. 

Tip 1 How to use a Parameter to sort different Measures in Tableau Desktop?

Have you ever created a list of Measures through a Parameter and then having troubles sorting them automatically? Also have you tried to solve the issue but either the Table created was a Table Calculation (so cannot be found in the sort options) or the Tableau Order of Operation is stopping your sort?

Use Case

Show different metrics such as Profit, Sales, Profit Ratio and First to Last Year difference on a bar chart with a toggle parameter. Also having the possibility to always sort the fields ascending even when the metrics changes.

Step 1. Create all the metrics, a Metrics parameter and a calculated field

Step 2. Create a sort parameter and a sort calculated field to sort the metrics either Ascending or Descending

Step 3. Sort the Dimension by the Sort calculated field. Remember that you won’t need it in the view or in the marks card. 

Now you can toggle between different metrics and have them always sorted automatically!

Tip 2 How to send emails from your Tableau Dashboard

Have you ever tried to be more efficient and be able to send emails from your Tableau dashboard? 

Step 1. Make sure there is an email field or create a mocked up version of it with your email address like in the example below.

Step 2. Create your view and add an email icon using shapes.

Step 3. Create a Dashboard, URL action

Customise the action as desired, test the link to check how the window will work and set up the URL target. I have also added an email body field, which is a simple calculated field with a basic email, starting and ending with quotation marks. 

Use fields to make this process as dynamic as possible. In the URL location add the following. 

mailto: <Email address>?subject=<Customer Name> Dashboard updates with <Customer Name> &body=Dear<Customer Name>,<Email body>

Step 4.

Select the mail icon on the dashboard and the email will open up. Always double check the email before sending it. (The To Email addresses are all mocked up fields from superstore)

Tip 3 How to create a Percentage of Total calculation using Level of Details instead of Tableau calcs?

Did you know that you could replace the Total function with a simple opened and closed curly brackets? It is in fact a simple level of detail calculation, which is looking at fixing the calc at the total in the view, since it is taking everything into account.

Therefore, if I want to know: what is the percentage of total sales for any specific dimension in the view, I could either type a Table Calculation.

COUNTD([Product Name]) / TOTAL(COUNTD([Product Name]))

Otherwise I could write the exact same calculation, using a LOD expression.

COUNTD([Product Name])/SUM({(COUNTD([Product Name]))})

You can see how, these two calculations, side by side will provide the exact same result.

Now, what if I wanted to calculate the percentage of sales made by a specific Sub-category for instance compared to the overall sales? What is its proportion?

Again we can use an ‘Overall’ LOD expression

We can identify the Sub-category contribution to total sales against the ‘Overal sales’ LOD.

{FIXED [Sub-category] : SUM([Sales])}

{SUM([Sales])}

We can now identify, not only which sub-categories sold the most products but also which one contributed to the most amount of sales.

Tip 4 Where to write the IF statement when using LOD

Have you ever written a Level of Detail expression and then realised that some filtering is needed?

However, since LOD are placed first compared to filters in the order of operations, an ad hoc calculation is needed inside the calculation.

Let’s calculate the Average Sales by category for only the First Class.

As a way to measure the correctness of our formula, let’s first build a simple view to identify the Avg Sales by Category. We can here identify that the Average Sales for the Technology Category in First class is 463.

Insert the IF statement before the LOD – why gives wrong results

We can write the following formula, which is giving a very big number when the IF calculation is performed before the LOD. 

if [Ship Mode] = ‘First class’ then 

{FIXED [Category],[Ship Mode] :

avg([Sales])} END

The calculation looks at the Ship mode first and then it provides the average. So now we have 139,366 for the same field.

Insert the IF statement after the LOD – why gives the correct results

We can write the following formula, which is giving the correct number when the IF calculation is performed inside the LOD. 

{FIXED [Category],[Ship Mode] :

avg

( if [Ship Mode] = ‘First class’ then ([Sales]) end )}

The calculation looks at creating the Avg sales for each category and ship mode first and then it filters out to only first class. So now we have 463 for the sales in First Class in Technology, the same as in the original view. 

Tip 5 Adding comments to a Dashboard on Tableau Server

Use Case: I have created a Dashboard view and published to the Server. I want now to notify my colleagues, who work in the West region and are interested in monitoring the profit of just the West.

I am going to interact with the Dashboard on Server and then add a comment with a tag @name_surname.

This will trigger an email, which will show the comment, as well as the filtered view as a snapshot.

Thank you for reading this blog series and feel free to reach out to laura.scavino@theinformationlab.co.uk with any questions. 

Want to learn everything about Tableau and Alteryx from the team at The Information Lab? 

Register to our Free Events here, also visit our learning path page here.In need of our Consulting expertise or Licencing offerings? Write to info@theinformationlab.co.uk for customised learning and support.

Laura Scavino

London, UK

Leave a Reply

Your email address will not be published. Required fields are marked *