@CALCMODE

English (Español a continuación)

This function allows you to determine the calculation mode that Essbase will apply when executing a formula:

  • @CALCMODE (CELL / BLOCK)
  • @CALCMODE (TOPDOWN / BOTTOMUP)

The calculation mode has two variants:

  • «Block calculation» / «Cell calculation» (they are mutually exclusive)
  • “Bottom-Up calculation” / “Top-Down calculation” (they are mutually exclusive)

When Essbase executes a calculation script, it applies by default the most efficient calculation mode, but there are times when the choice of Essbase is not the most optimal: this function allows to force Essbase to apply another calculation mode.

When Essbase applies the «Cell calculation» or «Top-Down calculation» mode in a formula, it records a message in the log.

I.- «Block calculation» / «Cell calculation»

Essbase applies two types of calculation:

  • “Block calculation”: calculates all the cells of a block simultaneously: this system is faster but in some cases it can lead to incorrect results (if the value of a cell depends on the value of another cell that should have been calculated before).
  • «Cell calculation»: calculates the cells of each block sequentially (one by one), following the order of calculation (which is determined by the order of the dense dimensions in the outline); this system is slower but sometimes it is necessary for the result to be correct.

Therefore «Cell calculation» may be necessary when there is dependency between cells: the value of one of the cells (cell B) depends on the value of another cell (cell A). In this case it is necessary to calculate the value of cell A before that of cell B.

By default Essbase applies the «Cell calculation» mode in formulas that contain the following functions:

  • @ANCEST
  • @CURRMBR
  • @ISMBR (in a dense dimension)
  • @MDANCESTVAL
  • @MDPARENTVAL
  • @MDSHIFT
  • @NEXT
  • @PARENT
  • @PARENTVAL
  • @PRIOR
  • @SANCESTVAL
  • @SPARENTVAL
  • @SHIFT

In the rest of the formulas Essbase applies by default the “Block calculation” mode.

Dependencies usually occur:

  • With the conditional structure IF… ELSEIF
  • With the @PRIOR function

I.1.- IF… ELSEIF

In these structures IF… ELSEIF Essbase calculates by sections: it starts by simultaneously calculating those members that meet the first condition; it continues to simultaneously calculate those members that meet the second condition, and so on.

If some of the formulas in which Essbase applies by default «Cell calculation» are used in this IF … ELSEIF structure, instead of going through sections, Essbase calculates the cells sequentially.

a) Let’s see an example: we consider that the dimension “Years” is dense:

If the starting point is:

If this function is calculated by blocks, the result is wrong:

The calculation sequence is:

  • 1º calculates 2019 = 2018 sales + 50 = 0 + 50 = 50
  • 2º calculates 2020 = 2018 sales + 100 = 0 + 100 = 100
  • 3º calculates 2021 = 2018 sales + 150 = 0 + 150 = 150
  • 4º calculates 2018 = 100

If this function is calculated by cells (calculation applied by Essbase by default), the result is correct:

The calculation sequence is:

  • 1º calculates 2018 = 100
  • 2º calculates 2019 = 2018 sales + 50 = 100 + 50 = 150
  • 3º calculates 2020 = 2018 sales + 100 = 100 + 100 = 200
  • 4º calculates 2021 = 2018 sales + 150 = 100 + 150 = 250

b) Let’s see another example: we consider that the dimension “Years” is dense. The order in which the conditions have been defined would allow us to use “Block calculation”, gaining efficiency, for this we use the @CALCMODE function (since by default with the @ISMBR function in dense dimensions Essbase applies “Cell calculation”):

I.2.- @PRIOR

Dependencies also occur in this function.

a) Let’s see an example: the data for each month will depend on the data of the previous month:

If the starting point is:

If we apply this formula with «Block calculation» we obtain the following result:

The calculation sequence is:

  • 1º calculates January = 100
  • 2º calculates simultaneously:
    • February = Sales_Budget January + 50 = 100 + 50 = 150
    • March = Sales_Budget February + 50 = 0 + 50 = 50
    • April = Sales_Budget March + 50 = 0 + 50 = 50

If we apply this formula with «Cell calculation» (default calculation) we obtain the following result:

The calculation sequence is:

  • 1º calculates January = 100
  • 2º calculates February = Sales_Budget January + 50 = 100 + 50 = 150
  • 3º calculates March = Sales_Budget February + 50 = 150 + 50 = 200
  • 4º calculates April = Sales_Budget March + 50 = 200 + 50 = 250

b) We return to analyze the previous example: according to the structure of the FIX, the first condition «January» is only fulfilled by 1/12 of the members; the rest of the members (February … December) fulfill the second condition «ELSE».

It is more efficient that the highest possible percentage of the members fulfill the first condition, if not the second…; for this we change the «IF» structure:

Both in the @ISMBR function and in @PRIOR function Essbase applies by default the “Cell calculation” mode, which in this example is necessary because there are dependencies (the “Block calculation” mode cannot be used).

II.- “Bottom-Up calculation” / “Top-Down calculation”

Essbase uses two calculation methods: «bottom-up» and «top-down».

  • In bottom-up mode, Essbase begins by determining from the existing blocks which need to be calculated and only calculates the blocks that are affected.
  • On the contrary, the «top-down» mode calculates all the potential blocks that can affect that specific member (whether they exist or not). This method is less efficient because it calculates more blocks but in some cases it ensures that the result is correct.

By default Essbase applies the «bottom-up» mode, which is faster than the «top-down».

However, when Essbase finds a complex formula for that specific member it applies the «top-down» mode, a method that slows down the calculation. Complex formulas are formulas that contain:

  • A finance function (@ACCUM, @ GROWTH…)
  • A relation function (@PARENTVAL, @ SHIFT …)
  • A range type function (@AVGRANGE, @MAXRANGE, @ SUMRANGE …)
  • A double-dimensional member (A = B-> D + C-> D)

Complex formulas applied to members of sparse dimensions considerably increase the volume of calculation, slowing it down.

With the @CALCMODE (BOTTOMUP) function, Essbase is forced to use the «bottom-up» calculation method in these cases where it would apply by default the «top-down» calculation. It can be useful when the outlines are large as it makes the calculation faster.

  • However, this command must be used with caution as forcing a bottom-up calculation in a complex formula can lead to an erroneous result, so before incorporating it into the calculation, it must be validated.

Let’s see an example of incorrect calculation:

We start from the following situation: we have two members «Cost» and «Price» of the sparse dimension «Variable»; we are going to calculate «Price» with the following formula:

  • Price = Cost * 1,2;

The starting situation is:

Applying the «bottom-up» mode to calculate the price gives the following result:

  • For «Product A» it does not calculate since there is no price block.
  • For “Product B” the result is also #missing (since it multiplies #missing * 1,2).
  • For “Product C” it ​​does calculate.

Applying the «top-down» mode the result is:

  • For “Product A” and “Product C” it ​​does calculate (it calculates all potential blocks even if they do not exist).
  • For «Product B» the result is #missing.

This calculation mode can be set:

  • In all calculations in the database: CALCOPTFRMLBOTTOMUP
  • In all or part of a calculation script: SET FRMLBOTTOMUP
  • In a specific formula: @CALCMODE function

III.- Syntax of this function

The syntax of this function is:

  • @CALCMODE (CELL / BLOCK)

To select between «Cell calculation» and «Block calculation».

  • @CALCMODE (TOPDOWN / BOTTOMUP)

To select between “Top-Down calculation” and “Bottom-Up calculation”.

Both selections can be used.

This function is used within a parenthesis associated with a member of the outline:

Any question, please send an email to: essbaseeasy@gmail.com

Español

Esta función permite determinar el modo de cálculo que Essbase va a aplicar al ejecutar una fórmula:

  • @CALCMODE(CELL / BLOCK)
  • @CALCMODE(TOPDOWN / BOTTOMUP)

El modo de cálculo tiene dos variantes:

  • “Block calculation” / “Cell calculation” (entre si son excluyentes)
  • “Bottom-Up calculation” / “Top-Down calculation” (entre si son excluyentes)

Cuando Essbase ejecuta un script de cálculo aplica por defecto el modo de cálculo más eficiente en cada momento, pero hay veces que la elección de Essbase no es la más optima: esta función permite forzar a Essbase a aplicar otro modo de cálculo.

  • Cuando Essbase aplica en una fórmula el modo “Cell calculation” o el “Top-Down calculation” registra un mensaje en el log.

I.- “Block calculation” / “Cell calculation”

Essbase aplica dos tipos de cálculo:

  • “Block calculation”: calcula todas las celdas de un bloque simultáneamente: este sistema es más rápido pero en algunos casos puede llevar a resultados incorrectos (si el valor de una celda depende del valor de otra celda que se debería haber calculado antes).
  • “Cell calculation”: calcula las celdas de cada bloque de forma secuencial (una por una), siguiendo el orden de cálculo (que viene determinado por el orden de las dimensiones densas en el outline); este sistema es más lento pero a veces es necesario para que el resultado sea correcto.

Por lo tanto “Cell calculation” puede ser necesario cuando hay dependencia entre las celdas: el valor de una de las celdas (celda B) depende del valor de otra celda (celda A). En este caso es necesario calcular el valor de la celda A antes que el de la celda B.

Por defecto Essbase aplica el modo “Cell calculation” en fórmulas que contienen las siguientes funciones:

  • @ANCEST
  • @CURRMBR
  • @ISMBR (en una dimensión densa)
  • @MDANCESTVAL
  • @MDPARENTVAL
  • @MDSHIFT
  • @NEXT
  • @PARENT
  • @PARENTVAL
  • @PRIOR
  • @SANCESTVAL
  • @SPARENTVAL
  • @SHIFT

En el resto de fórmulas Essbase aplica por defecto el modo “Block calculation”.

Las dependencias se suelen producir:

  • Con la estructura condicional IF…ELSEIF
  • Con la función @PRIOR

I.1.- IF… ELSEIF

En estas estructuras IF…ELSEIF Essbase calcula por secciones: comienza calculando simultáneamente aquellos miembros que cumplen la primera condición; continúa calculando simultáneamente aquellos miembros que cumplen la segunda condición, y así sucesivamente.

Si en esta estructura IF…ELSEIF se utiliza algunas de las formula en la que Essbase aplica por defecto “Cell calculation”, Essbase en lugar de ir por secciones calcula las celdas secuencialmente.

a) Veamos un ejemplo: consideramos que la dimensión “Años” es densa:

Si el punto de partida es:

Si esta función se calcula por bloques, el resultado es incorrecto:

La secuencia de cálculo es:

  • Primero calcula 2019 = ventas 2018 + 50 = 0 + 50 = 50
  • Segundo calcula 2020 = ventas 2018 + 100 = 0 + 100 = 100
  • Tercero calcula 2021 = ventas 2018 + 150 = 0 + 150 = 150
  • Cuarto calcula 2018 = 100

Si esta función se calcula por celdas (cálculo que aplica Essbase por defecto), el resultado es correcto:

La secuencia de cálculo es:

  • Primero calcula 2018 = 100
  • Segundo calcula 2019 = ventas 2018 + 50 = 100 + 50 = 150
  • Tercero calcula 2020 = ventas 2018 + 100 = 100 + 100 = 200
  • Cuarto calcula 2021 = ventas 2018 + 150 = 100 + 150 = 250

b) Veamos otro ejemplo: consideramos que la dimensión “Años” es densa. El orden en el que se han definido las condiciones permitiría utilizar “Block calculation” ganando en eficiencia, para ello utilizamos la función @CALCMODE (ya que por defecto con la función @ISMBR en dimensiones densas Essbase aplica “Cell calculation”):

I.2.- @PRIOR

En esta función también se producen dependencias.

a) Veamos un ejemplo: el dato de cada mes va a depender del dato del mes anterior:

Si el punto de partida es:

Si aplicamos esta fórmula con “Block calculation” obtenemos el siguiente resultado:

La secuencia de cálculo es:

  • Primero calcula Enero = 100
  • Segundo calcula simultáneamente:
    • Febrero = Ppto_Ventas Enero + 50 = 100 + 50 = 150
    • Marzo = Ppto_Ventas Febrero + 50 = 0 + 50 = 50
    • Abril = Ppto_Ventas Marzo + 50 = 0 + 50 = 50

Si aplicamos esta fórmula con “Cell calculation” (cálculo por defecto) obtenemos el siguiente resultado:

La secuencia de cálculo es:

  • Primero calcula Enero = 100
  • Segundo calcula Febrero = Ppto_Ventas Enero + 50 = 100 + 50 = 150
  • Tercero calcula Marzo = Ppto_Ventas Febrero + 50 = 150 + 50 = 200
  • Cuarto calcula Abril = Ppto_Ventas Marzo + 50 = 200 + 50 = 250

b) Volvemos a analizar el ejemplo anterior: tal como planteamos el FIX la primera condición “Enero” tan sólo la cumple un 1/12 de los miembros; el resto de miembros (Febrero…Diciembre) cumple la segunda condición “ELSE”.

Es más eficiente en los “IF” que el mayor porcentaje posible de los miembros cumplan la primera condición, si no la segunda…; para ello replanteamos el “IF”:

Tanto en la función @ISMBR como en @PRIOR Essbase aplica por defecto el modo “Cell calculation” que en este ejemplo es necesario ya que hay dependencias (no se puede utilizar el modo “Block calculation”).

II.- “Bottom-Up calculation” / “Top-Down calculation”

Essbase utiliza dos métodos de cálculos: “bottom-up” y “top-down”.

  • En el modo “bottom-up” Essbase comienza por determinar de los bloques existentes cuales necesitan ser calculados y únicamente calcula los bloques que se ven afectados.
  • Por el contrario, el modo “top-down” calcula todos los bloques potenciales que pueden afectar a ese miembro concreto (existan o no). Este método es menos eficiente porque calcula más bloques pero en algunos casos asegura que el resultado sea correcto.

Por defecto Essbase aplica el modo “bottom-up”, que es más rápido que el “top-down”.

No obstante cuando Essbase encuentra una fórmula compleja para ese miembro concreto aplica el modo “top-down”, método que ralentiza el cálculo. Fórmulas complejas son fórmulas que contienen:

  • Una función financiera (@ACCUM, @GROWTH…)
  • Una función de relación (@PARENTVAL, @SHIFT…)
  • Una función tipo range (@AVGRANGE, @MAXRANGE, @SUMRANGE…)
  • Un miembro de doble dimensión (A = B->D + C->D)

Las fórmulas complejas aplicadas a miembros de dimensiones dispersas aumentan considerablemente el volumen de cálculo, raletizándolo.

Con la función @CALCMODE(BOTTOMUP) se fuerza a Essbase a utiliar el método de cálculo “bottom-up” en estos casos en los que por defecto aplicaría el cálculo “top-down”. Puede ser útil cuando los outlines son de gran tamaño ya que permite aligerar el cálculo.

  • No obstante este comando hay que utilizarlo con precaución ya que forzar un cálculo “bottom-up” en una fórmula compleja puede llevar a un resultado erróneo, por lo que antes de incorporarlo al cálculo hay que validarlo.

Veamos un ejemplo de cálculo incorrecto:

Partimos de la siguiente situación: tenemos dos miembros “Coste” y “Precio” de la dimensión dispersa “Variable”; vamos a calcular “Precio” con la siguiente fórmula:

  • Precio = Coste * 1,2;

La situación de partida es:

Aplicando el modo “bottom-up” para calcular el precio da el siguiente resultado:

  • Para “Product A” no calcula ya que no existe bloque de precio.
  • Para “Product B” el resultado también es #missing (ya que multiplica #missing * 1,2).
  • Para “Product C” sí calcula.

Aplicando el modo “top-down” el resultado es:

  • Para “Product A” y “Product C” sí calcula (calcula todos los bloques potenciales aunque no existan).
  • Para “Product B” el resultado es #missing.

Este modo de cálculo se puede establecer:

  • En todos los cálculos de la base de datos: CALCOPTFRMLBOTTOMUP
  • En todo o parte de un script de cálculo: SET FRMLBOTTOMUP
  • En una fórmula concreta: función @CALCMODE

III.- Sintaxis de esta función

La sintaxis de esta función es:

  • @CALCMODE(CELL / BLOCK)

Para seleccionar entre “Cell calculation” y “Block calculation”.

  • @CALCMODE(TOPDOWN / BOTTOMUP)

Para seleccionar entre “Top-Down calculation” y “Bottom-Up calculation”.

Se pueden utilizar ambas selecciones.

Esta función se utiliza dentro de un paréntesis asociado a un miembro del outline:

Cualquier consulta envía, por favor, un correo a: essbaseeasy@gmail.com

Anuncio publicitario