Introduction
This article isn’t spectacular and it may not appeal to a wide audience, but does illustrate some interesting insights for new users of Tableau’s level of detail (LOD) calculations.
This article contains some insights using real-world data to show when LOD fixed calculations occur with respect to dimension and context filters.
The two included videos demonstrate the details of the order of operations for LOD fixed calculations. I do not discuss the other two LOD constructions of include/exclude. This single example shows why you need to pay attention to the order of operations to get the results you are interested in achieving.
Background
Unless your name is Jonathan, Joe, Joshua, or Bora, or various other Tableau guru’s, you may not yet fully appreciate how the order of operations conducted by Tableau in version 9.0+ can impact the results you are shown. For me, sometimes the order of operations used by Tableau can be mystifying, especially when using new features.
In general, I understand the need to comprehend the order of operations from writing over 30 years of computer programs. Sometimes I have to stop what I am doing to document the insights I have learned so that I can remember them in the future. That is why I am writing this article.
Sometimes when I use Tableau, I don’t immediately appreciate what is going on behind the scenes when data is presented to me in tables and figures. There have been many times when I have had to dive deep into the source data to understand how the order of operations created the results I received.
With the new Level of Detail (LOD) constructions available in Tableau, I had to pause my analysis to understand how to use LOD calculations correctly. I had to use Alteryx to pull a hundred-plus records out of a big database to uncover what was going on behind the scenes in Tableau.
A Real-World Example
Recently, I took a look at using the LOD fixed approach to analyze data stored in a multi-million line database. As I got into the application, I realized that there were some things happening that I wasn’t understanding.The data I was seeing from Tableau didn’t match my expectation because it didn’t match the other approach I used on the problem.
To eliminate my confusion, I turned to one of the best Tableau bloggers on planet earth. As shown in Figure 1, Bora’s excellent article on LOD calculations was the first place I stopped to solve my problem.
Rather than write a long article about what I learned, I just made two instructional videos that verify Bora’s written words through the use of my example. The first video discusses the details of how and why I was receiving an unexpected result in Tableau. To understand the issue, I compared two methods in Tableau to learn why I was receiving results that were inconsistent. This video demonstrates and discusses the order of operations of the fixed LOD and a dimension filter.
In the second video, I show how you can promote a dimension filter to a context filter to change the order of operations conducted by Tableau. By performing this operation, consistent results were achieved in my example. Since this example made me stop and think for a while, I thought it would be a good topic to document in this article.
Final Thoughts
Whenever I read articles that discuss order of operations, many times it is difficult to fully appreciate what is being said without spending time in an example data file. I created this article to make it easier for others to comprehend what I recently learned by illustrating what Tableau does when LOD operations are performed.
Hi Ken, it’s the first time I write here. I certainly do find this post very interesting because I came up with the same solution for a similar problem a few weeks ago. I was wondering if there was a better solution for it but now that I see this post I know I was in the right direction: https://twitter.com/jorgeluis500/status/631819744002371584
Hi Jorge,
Yes, your example is exactly analogous to my example. I downloaded your workbook and turned the context filter on and off. To get the right behavior for your application, you need the invoice date to be added to the context. Otherwise you don’t get the correct max invoice rank with respect to your time filter. Great minds think alike. Thanks for sharing!
Ken
Peter Gilks has written an excellent blog on the use of context filters
http://paintbynumbersblog.blogspot.com/2015/11/lets-put-some-things-into-context.html