This blog is inspired by blog: Top 15 Tableau LOD Expressions (Practical Examples).

Tableau LOD (Level of Detail) Expression is one of the most powerful tools to achieve amazing results in building dashboards. In this series of blogs, we will walk through 15 different use cases to demonstrate the usage of LOD expression.

Since this is a series blogs, please use the navigation below to jump to the one you need quickly:

Population Difference

In this example, we will list the population of all the countries and show the difference between each country and a selected country. The data source we use today is the Tableau saved data source: world indicator.

  1. Let’s first crate a country parameter so that we can select the country we want to compare. We need to drag country/region field to column and

2.As we need to create a parameter to select country on dashboard, we just right-click “Country/Region” field to create a parameter.

3. As we need a calculated field to show the population of the selected country, we create a field as below image:

If we drag the calculated field to the column shelf, we will get the viz as below. We can see that as the Country/Region filter applied for the selected population chart, so there’s only one bar shows, so we can’t use the population for other countries to subtract the population from the selected country.

4. Now let’s create another LOD as below:

Then we drag this new created field to column shelf and we can get the visualization as below. We can see that as we EXCLUDE the Country/Region filter, the population of the selected country shows for each row. For now, we could just use the population on the left bar chart, subtract the population on the left, we can get the population difference.

5. Let’s create another calculated field to do this calculation:

If we drag this field to column shelf, we can get the desired chart as below:

I have create a dashboard with this chart in Tableau public and hope you like it.


Yi Gao
Author: Yi Gao

Yi has a master’s degree in data science from The University of Sydney and a background in engineering and manufacturing. She is passionate about finding insights from large and diverse datasets and applying them to real-world scenarios. In her previous role at Daimler China, she analysed vehicle usage data, provided recommendations and created dashboard for internal customers. In her spare time, she enjoys photography, especially of animals and her two sons, and cooking traditional Chinese food.