Select Page

This blog is part of the How To Use Level of Detail blog series. Today’s blog will cover the INCLUDE Level of Detail expression and function.

The INCLUDE level of detail expression calculates the specified Dimension/s in your syntax in addition to the dimensions already in your view. In other words, the INCLUDE expression is for calculating a higher level of detail without changing your view.

A case scenario for this to answer the following question using the Superstore dataset, “On average, which region has the best performing cities in sales?”. Notice how we have two levels of details required here – region and city. To answer this question, we would need to:

1.  First, find the max sales of each city,
2. then average these max sales for each region.

The expression used to calculate this can be read from right to left. Find the Maximum Sales value for each city, and then find the average of this for each dimension in the shelf. In this scenario, we only have the ‘Region’ dimension in the shelf, so Tableau would only compute our results by this dimension.

Putting our newly created ‘Avg. Max Sales Per City’ measure into our view, these are our values. I always recommend checking your newly created expressions in crosstab first to verify the accuracy of your syntax and calculations as it can be easy to make mistakes, especially as you make more and more complicated expressions.

Now to make it into a viz, here is a map of the US showing on average, which region has the best performing cities in sales.

#### Read more from theHow To Use Level of Detail in Tableau series:

How To Use Level of Details – General Level of Detail

How To Use Level of Details – Exclude Function

How To Use Level of Details – Fixed Function