Level of Detail Part 3: Exclude & Include

by Peter Silvester

LoD expressions give you the power to perform calculations that are independent of the level of detail in your view. Tableau has incorporated three ‘scoping keywords’ into LoD expressions and each allows you to determine the LoD you want in a different way.


For this episode of the series we are going to focus on ‘Include’ and ‘Exclude’ expressions. From the diagram above you can see that they basically act as opposites of each other in terms of how they affect the level at which your calculation is being performed. The Exclude keyword will aggregate at a higher level than what is in the view LoD, whereas Include will decrease the level of aggregation and move it down from the viz LoD.




In this example we see that State and City are in the view so determine the view level of detail. However we want to calculate the total sales per Country so we need to go up in the LoD. Using an Exclude expression allows us to not consider the State or the City in our aggregation. In this case because all the Cities are in the USA it will return the same value for every row.




When we want to calculate aggregations at a lower level of granularity we can use the Include keyword in our expression. For this example we want to see how much each City within a State sold on average without having to bring the City field into the view. The Include expression calculates the aggregation at the lower level of City.




Peter Silvester

Thu 01 Dec 2016

Wed 23 Nov 2016

Tue 22 Nov 2016