ReferenceLevelLocationShift

This post-processor shifts an underlying measure to an upper location to perform comparisons. It works with the IReferenceLevelContextVal context value to define the reference level.

Definition

ReferenceLevelLocationShift
        .measure()
        .withUnderlyingMeasure(value)
        .withType(ILiteralType.DOUBLE)
        .as("reference")
        .publish(context);

injectAll(IReferenceLevelsAware.class, List.of(null, "L1@H1", "L2@H1"));

Here are the parameters of the measure function:

Parameters Type Mandatory Usage
underlyingMeasure CopperMeasure X The underlying measure that is copied to this metric.
type String X The measure type, one of the ILiteralType define.
referenceLevel LevelIdentifier…
leafLevels LevelIdentifier…
targetMeasures CopperMeasure…

Context values

IReferenceLevelContextVal

The context value must also be set up by injecting the list of available reference levels as shown on the example. It is filled with a list of level strings that will be displayed to the user. The list must have the following unambiguous format: “level@hierarchy@dimension”, “level@hierarchy” or “level”.

  • Reference levels: The reference levels should be injected after the metric is created because the context value is only registered once the metric is defined.
  • Top level: The Top level is also added by default to the selectable levels, it is named “Enterprise”, it is selected with a null or empty value.
  • UI display name: The UI name of the context value is “ReferenceLevel”.

IReferenceLevelVisualTotalsModeContextVal

UI display name: The UI name of the context value is “ReferenceLevelVisualTotalsMode”.

This context value affects the interpretation of filters for incremental measures.

When a capital allocation query includes filters, then the filtering is applied as follows:

  • With VISUAL TOTALS, filtering is applied to the underlying data before calculating the capital allocation. The capital allocations sum to the capital charge of the filtered data.

  • With NON-VISUAL TOTALS, the results are as if the filtering was applied to the result set after calculating the capital allocation. The capital allocations would sum to the capital charge of the unfiltered data, though some are filtered out of the results.

This context value can take three values, each corresponding to a specific mode:

Mode Description
(default) COMPATIBILITY Uses the visual or non-visual totals specified in the MDX.
For example
WHERE-clause for non-visual totals
SUBSELECT-clause for visual totals
VISUAL Forces the use of visual totals.
NON VISUAL Forces the use of non-visual totals.

Behavior

If the user selects “L1@H1” as a reference level:

  • All the locations with H1 above L1 will return empty cells.
  • The locations with H1 equal to or below L1 will return the value of L1.
  • The hierarchies other than H1 will be reset to the level 0 value.

Example

If we have H1:AllMembers/L1/L2, H2:AllMembers/L1, H3:L1/L2, the location shifts for the “L1@H1” as a reference level will be as follows:

  • H1/AllMembers,H2/L1,H3/L1 => empty
  • H1/L1,H2/L1,H3/L1 => H1/L1,H2/AllMembers,H3/L1
  • H1/L2,H2/L1,H3/L1 => H1/L1,H2/AllMembers,H3/L1
  • H1/L2,H2/L1,H3/L2 => H1/L1,H2/AllMembers,H3/L1