It’s week two and earlier this week we “graduated” from Tableau Fundamentals. Cue the celebrations, right?
Apparently, our reward was to dive into LODs. For anyone unfamiliar with LODs, I’m pretty sure they stand for Little Odd Demons or Lumpy Old Dumplings – in any case, they’ve made my brain melt enough that I can’t even think of a good enough way to mock them.
Of course, I’m actually talking about Level of Detail Expressions
My journey so far has been:
- Stumble across them whilst doing my application, think “I don’t have a clue what these are doing, but look, I can copy and paste and not worry and my problem is solved”
- Be introduced to LODs by guest teacher Hanna (@hanykowska) and start to feel fear (despite her good teaching)
- Be reassured by Andy with some back to basic examples
- Spend a whole day on LODs with Carl and become completely frazzled
I can only hope that Andy will return to reassure once more.
But until then, I’ll have to take matters into my own hands by trying to explain the basic knowledge I think I have so far
Ok, so first off there are 3 different LOD calculations: FIXED, INCLUDE and EXCLUDE.
As far as I can tell, FIXED calculations aggregate the data to a specified field. Alexander (@Datastorydesign) gave me the helpful tip to think of FIXED as saying “for each”. So the above example would read “for each category, return the sum of sales.” Of course, this can also be read as “fix the category as the place to aggregate when calculating the sum of sales.”
This could be useful if you wanted to know the total sales for each category, whilst also having sub-category in the view.
So if a FIXED calculation is all about telling Tableau what to focus on, an EXCLUDE calculation makes sure it ignores certain fields and aggregates at a higher level. In the above example, say department is one step up the hierarchy from category. This would mean that, provided department is in the view, the sales shown would be aggregated to a department level rather than a category level.
This is useful if we start filtering the categories, because this calculation will update to reflect the changes.
INCLUDE becomes useful when you want an aggregation at quite a low level of granularity, but without having to actually see the granularity in the worksheet.
For example, if you wanted to know the maximum sales by a single customer for each category, you could drag the above calculated field into the view, make sure it is aggregated as a maximum and you would have your answer! (As long as category is also in the view, of course)