#LODSofFun- Difference from selected

by Lorna Eden

A couple of weeks back I taught the data school some Level of Detail (LODs) calculations and went through some examples. I recently used one within my makeover Monday.

As you can see the parameter is allowing the user to select a year to compare online hotel revenue and travel agent numbers to that selected year.

Click image to interact.

DFS MM GIF

 

I am going to show you how to do this with a superstore sales EU example. We are going to answer the following question- How do sales of countries compare to a selected country?

 

First of all open up Sample- EU Superstore, this should be located within your ‘My Tableau Repository’. Next we need to create a parameter that shows all the different countries. Then show parameter control.

Create a Parameter GIF

 

Now we need a formula that tells the parameter how to work

Parameter Control formula

 

Now drag Country to rows, Sum(Sales) to Columns and Country Parameter Control to Columns and put labels on. As we can see the parameter calculation only shows the country that is selected by the parameter.

1

 

The next step is to create an LOD calc.

2

 

Then drag the LOD Country Parameter Sales to replace the 2nd green pill. As you can see this LOD calc excludes the individual country sales and returns sales for the country selected by the parameter.

3 gif (2)

 

Now we need to create a calculation that is difference from selected country. We minus the LOD calc of the sum of sales because that will give you the difference between the two.

4

 

The new calculation replaces the 1st green pill. This now compares the selected country sales to other country sales. Then put sum(sales) to replace the 2nd green pill and the difference calculation onto colour of the first marks card.

8

 

The final stage if you want to make things a little easier visually, is to create a true false calculation to show which one is selected and hide all the others.

6

 

Then drag this onto colour on the second marks card

9 gif

 

At the end sort by the sum of sales

10

 

Then use the parameter to see how different countries compare to the selected country

11 gif

 

I hope this helps. Have fun creating this difference from selected.

 

Thanks

#DS2TipWeek - Publishing to Tableau Server using Command Prompt

2 mins read

Fri 19 Feb 2016

#DS2TipWeek - Arranging Shapes Using Index

3 mins read

Thu 18 Feb 2016

#DS2TipWeek - LODs of Fun with Custom Dates

2 mins read

Wed 17 Feb 2016

#DS2TipWeek - Fill a Date Range Using Alteryx

3 mins read

Tue 16 Feb 2016