When and why does a standard FIXED LOD expression behave like a Table-Scoped LOD expression?
LOD Expression Syntax
In general a LOD expression in Tableau will have at least three components as per the below syntax:
{[FIXED | INCLUDE | EXCLUDE] <dimension declaration > : <aggregate expression>}
Component#1: {} Curly braces or Parentheses
The entire LOD (Level Of Detail) expression is enclosed in curly braces.
Component#2: Scoping Keyword
The first component after the opening curly braces is one of the scoping keywords i.e. FIXED, INCLUDE or EXCLUDE
Component#3: Dimension Declaration
This is used to specify one or more dimensions that sets the scope of the aggregate expression, according to the keyword. e.g: FIXED [Category]
Component#4: : (a colon)
A colon is used to separate the dimension declaration from the aggregate expression.
Component#5: Aggregate Expression
The aggregate expression is the calculation that is performed.
For example, SUM([Profit]) . The results of the calculation in the aggregate expression depend on the dimension declaration and scoping keyword.
Table-Scoped LOD
Of course there is an exception to the standard FIXED LOD expression syntax. This is where the Table-Scoped LOD comes into the picture. For a Table-Scoped Level Of Detail expression, no scoping keyword is required.
Table-scoped LODs will contain only the aggregate expression inside the braces, such as {MIN([Order Date])} or {SUM([Sales])}.
Consider that we have two dimensions in the view and they are not in a Hierarchy e.g: Ship Mode and Category i.e. they are not related to each other.
FIXED LOD expression is { FIXED [Category]: SUM([Sales]) }
By default FIXED LOD expression would fix the granularity at the Category level and remembers the Sales aggregated value w.r.t dimension fixed at Category.
So when we have both Ship Mode and Category in the view the values of FIXED LOD are duplicated.
Now if we remove Category from the view then the LOD value will show the value of 2,297,201 for each member of Ship Mode.
Why is this happening or When and why does the standard FIXED LOD expression behave like a Table-Scoped LOD expression?
The reason for this is that each member of Ship Mode (First Class, Same Day, Second Day and Standard Class) contains all members of Category hence the Sales value will be aggregated to 2,297,201 for each member of Ship Mode.
This value is same as the value of the Table Scoped LOD expression i.e. { SUM([Sales]) }
I hope this article is useful for all Tableau users especially anyone who is new to Tableau!!!