3 Replies Latest reply on Apr 26, 2017 3:25 PM by Justin Larson

# What is level of detail calc?

This formula isolates a certain year I think. How does it work and how is it different from if(year)=x then [sales], for example.

If{Max(Year([Order Date]))}=YEAR([Order Date]) THEN [Sales]

END

• ###### 1. Re: What is level of detail calc?

good video on fixed: FIXED LOD Examples - Part 1 - YouTube

Great video from Tableau: Think Data Thursday: LoD of the Rings - YouTube

1 of 1 people found this helpful
• ###### 2. Re: What is level of detail calc?

Thanks Matt. Would you mind taking a stab at logic/structure of that formula I had?

• ###### 3. Re: What is level of detail calc?

{Max(Year([Order Date]))} is not a typical use for LOD expressions that I've seen, but interesting, actually that it's used in this way. Normally, you would see either INCLUDE, EXCLUDE, or FIXED argument, to partition the records into subsections. Since you don't have this argument, the entire dataset is a single partition. From this partition, you are evaluating the largest Year of OrderDate. This result can be conceptualized as evaluating the same for every record in the dataset (though that is not explicitly technically true, bear with me).

You then compare this value, which is the same on every row to the Year of the Order Date on that row. If it is the same, that row will show value from Sales field on same row. Since you do not have an else statement, if the years are not the same, the value will implicitly return null.

The effective result of this calculation is that it will represent sales from the most recent year in your dataset only. Since there is no implicit aggregation here, you would still be able to take average, sum, or whatever aggregate you want when you drag it onto the view - the calculation is in the row context, just like a raw field in your dataset. If you preview your data, you should see this calculation show the same on each row as Sales field, but Null for prior years' data.

1 of 1 people found this helpful