English (Español a continuación)
The following functions calculate the sum / count the number of data within a range.
- In the next examples, suppose a database with the sales of a company in its different markets; This database has, among others, the dimensions «Markets», «Years», «Months» and «Indicators. We will include these formulas in the outline, in the member “Obj_2022” (of the dynamic dimension “Indicators”).
a) sum
To obtain the sum of values in a range we use the following structure:
- Sum(«Range»)
Let’s see an example: we include the following formula in the outline, in the «Obj_2022» member:
- Sum(Crossjoin({Sales},{Crossjoin({“2021”},{[Jan]:[Dec]})})) * 1.2
Calculates the value of «Obj_2022» as the sum of sales in year 2021 multiplied by 1.2
We can use the “CASE” function to discriminate. Suppose the following dimension «Markets»:

We include the following formula in the “Obj_2022” member:
- Case
- When IsAncestor([Europe], [Markets].currentmember) then
- Sum(Crossjoin({Sales},{Crossjoin({“2021”},{[Jan]:[Dec]})})) * 1.4
- When IsAncestor([America], [Markets].currentmember) then
- Sum(Crossjoin({Sales},{Crossjoin({“2021”},{[Jan]:[Dec]})})) * 1.1
- End
In this example:
- When the market is a descendant of «Europe» it calculates the value of «Obj_2022» as the sum of the sales in year 2021 multiplied by 1.4
- When the market is descendant of «America» it calculates the value of «Obj_2022» as the sum of the sales in year 2021 multiplied by 1.1
b) Count
To obtain the number of data in a range we use the following structure:
- Count(“Range”)
Let’s see an example:
- Count(Crossjoin({Sales},{Crossjoin({“2021”},{[Jan]:[Dec]})}))
Counts the number of data in the specified range.
- Counts both zeros and missing.
If we want to exclude missing we use the following formula:
- NonEmptyCount(Crossjoin({Sales},{Crossjoin({“2021”},{[Jan]:[Dec]})}))
If we want to exclude zeros but not missing, we use the following formula:
- NonEmptyCount(Crossjoin({Sales},{Crossjoin({“2021”},{[Jan]:[Dec]})}), IIF(Month.currentmember.Value = Missing, 0, IIF(Month.currentmember.Value = 0, Missing, Month.currentmember.Value)))
If we want to exclude missing and zeros:
- NonEmptyCount(Crossjoin({Sales},{Crossjoin({“2021”},{[Jan]:[Dec]})}), IIF(Month.currentmember.Value = 0, Missing, Month.currentmember.Value))
Any question, please send an email to: essbaseeasy@gmail.com
Español
Las siguientes funciones calculan la suma / cuentan el número de datos dentro de un rango.
- En los siguientes ejemplos, supongamos una base de datos con las ventas de una compañía en sus distintos mercados; esta base de datos cuenta, entre otras, con las dimensiones “Mercados”, “Años”, “Meses” e “Indicadores. Vamos a incluir estas fórmulas en el outline, en el miembro “Obj_2022” (de la dimensión dinámica “Indicadores”).
a) Sum
Para obtener la suma de valores de un rango utilizamos la siguiente estructura:
- Sum(“Rango”)
Veamos un ejemplo: incluimos la siguiente fórmula en el outline, en el miembro “Obj_2022”:
- Sum(Crossjoin({Ventas},{Crossjoin({“2021”},{[Ene]:[Dic]})})) * 1.2
Calcula el valor de “Obj_2022” como suma de las ventas del año 2021 multiplicadas por 1,2
Podemos utilizar la función “CASE” para discriminar. Supongamos la siguiente dimensión “Mercados”:

Incluimos la siguiente fórmula en el miembro “Obj_2022”:
- Case
- When IsAncestor([Europa], [Mercados].currentmember) then
- Sum(Crossjoin({Ventas},{Crossjoin({“2021”},{[Ene]:[Dic]})})) * 1.4
- When IsAncestor([America], [Mercados].currentmember) then
- Sum(Crossjoin({Ventas},{Crossjoin({“2021”},{[Ene]:[Dic]})})) * 1.1
- End
En este ejemplo:
- Cuando el mercado es descendiente de “Europa” calcula el valor de “Obj_2022” como suma de las ventas del año 2021 multiplicadas por 1,4
- Cuando el mercado es descendiente de “América” calcula el valor de “Obj_2022” como suma de las ventas del año 2021 multiplicadas por 1,1
b) Count
Para obtener el número de datos en un rango utilizamos la siguiente estructura:
- Count(“Rango”)
Veamos un ejemplo:
- Count(Crossjoin({Ventas},{Crossjoin({“2021”},{[Ene]:[Dic]})}))
Cuenta el número de datos que hay en el rango especificado.
- Cuenta tanto ceros como missing.
Si queremos excluir los missing utilizamos la siguiente fórmula:
- NonEmptyCount(Crossjoin({Ventas},{Crossjoin({“2021”},{[Ene]:[Dic]})}))
Si queremos excluir los ceros pero no los missing utilizamos la siguiente fórmula:
- NonEmptyCount(Crossjoin({Ventas},{Crossjoin({“2021”},{[Ene]:[Dic]})}), IIF(Mes.currentmember.Value = Missing, 0, IIF(Mes.currentmember.Value = 0, Missing, Mes.currentmember.Value)))
Si queremos excluir los missing y los ceros:
- NonEmptyCount(Crossjoin({Ventas},{Crossjoin({“2021”},{[Ene]:[Dic]})}), IIF(Mes.currentmember.Value = 0, Missing, Mes.currentmember.Value))
Cualquier consulta envía, por favor, un correo a: essbaseeasy@gmail.com