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.
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.
Now we need a formula that tells the parameter how to work
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.
The next step is to create an LOD calc.
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.
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.
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.
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.
Then drag this onto colour on the second marks card
At the end sort by the sum of sales
Then use the parameter to see how different countries compare to the selected country
I hope this helps. Have fun creating this difference from selected.