It is recommended to get familiar with memberSum function and its variations before proceeding with this tutorial.

When evaluating formulas, BellaDati proceeds in following fashion:

  1. Apply Member aggregation function to particular Indicators. (SUM, MIN, MAX, AVG, COUNT)
  2. Execute user defined Operations among Indicators. (+,-,*,/).

However, sometimes this behavior is not demanded.

Imagine following situation. You have Price and Quanity indicators and want to display Total Sales. In its standard behavior, BellaDati would sum all prices and quantities and eventually multiply it. Nevertheless, right procedure will be to multiply Price and Quantity on every row and subsequently consolidate result to display Total Sales.

Calculating Total Sales

You can leverage memberSum function to force BellaDati to execute defined operation on particular level. Since multiplication of Price and Quantity is needed on every row, use unique key attribute as memberSum parameter.

This example is sufficient for indicators without drill-down path applied. Proceed further to find out how to extend this code in case of desired dimensionality.

int sales = 0
membersSum('L_ID'){
	int revenue = (M_QUANTITY * M_PRICE)
  sales = sales + revenue
}

return sales

Calculating Total Sales For Particular Drill-Down

If you want drill-down path to be considered while applying memberSum function, you have to explicitelly define it in developed formula. Place desired attribute code before unique key definition as shown in the following example. This will ensure that your data are correctly multiplied and subsequently aggregated.

Note that order of parameters in memberSum function is important. Also, you still need to select particular attribute in drill-down path definition.

int sales = 0
membersSum('[L_DEPARTMENT][L_ID]'){
	int revenue = (M_QUANTITY * M_PRICE)
  sales = sales  +  revenue
}

return sales 

You can extend dimensionality by adding more parameters into the formula.

You can observe result of the applied formula in the following table. Same settings would apply for char data visualization.

Next Steps