Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Sv translation
languageen
Note

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.

Info

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.

Tip

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.

Code Block

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

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

Code Block

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

return sales 
Tip

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.

ilupng
memberSum

Next Steps

Sv translation
languageja
Note

このチュートリアルに進む前に、memberSum機能とそのバリエーションを十分参照することをお勧めします。

フォーミュラの評価に関して、BellaDatiは以下の方法で進めます:

  1. メンバー集合体機能を特定のインディケーターに適用します(SUM, MIN, MAX, AVG, COUNT)
  2. ユーザー定義オペレーションインディケーターに実行します(+,-,*,/)

しかし、時々この行動が必要でない場合もあります。

Info

以下の場合を想定してみてください。価格インディケーターとインディケーターがあり、総売上を表示したいとします。標準の行動では、BellaDati では全ての価格と量を合計し、掛け合わせます。それにも関わらず、正しい工程はそれぞれの行で価格を掛け算し、その後結果を統合し総売上を表示します。

総売上の計算

memberSum機能を活用し、BellaDatiに強制的に特定のレベルでの定義オペレーションを実行させることができます。それぞれの行で価格を掛け合わせる必要があるため、memberSumパラメーターとして固有キーアトリビュトが使用できます。

Tip

この例はドリルダウンコースなしのインディケーターでは十分です。希望の次元にこのコードを拡張される方法は以降で述べられています。

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

return sales

特定のドリルダウンの総売上を計算

memberSum機能の適用中にドリルダウンコースを考慮したい場合は、発展したフォーミュラに明確に定義しなければいけません。以下の例のように、固有キー定義の前に希望のアトリビュトコードを置いてください。これによりあなたのデータは正しく掛け合わされその後統合されます。

Note

memberSum機能のパラメーター順は重要です。 また、特定のアトリビュトをドリルダウンコース定義で選択しなければいけないことにご注意ください。

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

return sales 
Tip

フォーミュラにパラメーターを追加することで次元的に拡張できます。

以下の表で適用されたフォーミュラ結果を見ることができます。同様の設定は特性データのビジュアル化にも適用されます。

ilupng
memberSum

Next Steps