Fixed

With Fixed, all the Dimensions that you want to include in the level of detail must be specified. So, if you want to exclude an existing Dimension, don't specify it, and if you want to include one, specify it. Here's how to rewrite the two previous LOD calculations with Fixed:

  • { EXCLUDE [Sub-Category]: MAX([Sales]) } is equivalent to { FIXED [Category] : MAX([Sales]) } in the previous example. If you want to remove the Sub-Category, you don't specify it.
  • AVG( { INCLUDE [Segment]: MAX([Sales]) } ) is equivalent to AVG( { FIXED [Category],[Sub-Category],[Segment]: MAX([Sales]) } ) in the previous example. If you want to add the Segment, you have to add all the existing Dimensions, plus the Segment.

Calculated Fields that use a Fixed function have three advantages. First, they are easier to understand. You write all the Dimensions that you want to use, and that's it, Tableau only uses them to aggregate the calculation, no matter what's in the View.

The second advantage is even more interesting: Fixed calculations are not impacted by Dimension Filters. If you remember, the Filter hierarchy looks like this: 

As you can see, the Include and Exclude functions are impacted by the Dimension Filters, but not Fixed, unless they are in Context. 

Let's see how to use this to your advantage with an example. Let's display, by Sub-Category, and with a Filter on State keeping only California, the following three Measures:

  • A normal aggregation, the sum of sales: SUM([Sales])
  • A Fixed calculation: SUM( { FIXED [Sub-Category]: SUM([Sales]) } )
  • The ratio of the two previous Measures: SUM([Sales]) / SUM( { FIXED [Sub-Category]: SUM([Sales]) } )

Here's the result:

As before, let's spend some time understanding it:

  • The first value is a simple aggregation. It returns the sum of sales by Sub-Category, filtered on California.
  • The second calculation, SUM( { FIXED [Sub-Category]: SUM([Sales]) } ), returns the sum of sales by Sub-Category for all States. As State is not specified in the list of Dimensions in the Fixed function, the filter has no power over this calculation.
  • The third calculation, SUM([Sales]) / SUM( { FIXED [Sub-Category]: SUM([Sales]) } ), calculates the ratio between the two previous calculations. It calculates the percentage of sales in California (the first part of the ratio) against total sales (the second part). It's a typical usecase of the useful Fixed calculation.

The third and last advantage is also very useful: Fixed allows you to remove duplicates in your data. As you can specify the level of detail of a Measure, you can return the unique value of a Measure (with MAX or MIN) by its unique row identifier. Hard to picture? The following hands-on tutorial shows you how to deduplicate your data.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.16.51.157