Versions Compared

Key

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

It happens very frequently that we use a few drill downs in our tables, and we want to calculate the average of indicators at different levels.

Note

It is recommended to get familiar with memberValue and crossValue functions before proceeding with this tutorial.

In the table below, you can see two drill down levels (Employee Name and Product). Avg. Rating is calculating the average rating for that employee on that product.

ilupng
Avg_1

But you may want to compare the employee's average rating for a product with the overall employee rating for the same product as a benchmark, as it is shown in the Avg. Benchmark column. This could be added as a conditional formatting, so if the employee's avg. rating on a product is higher than overall employee's rating on this product, we can mark it as green and show an upper arrow there.

Here is how you could calculate this.

Code Block

if(!equals(substringBefore(memberValue(), ' ') ,'Product')) { 
  return ''; 
} else { 
  filter("L_PRODUCT in ('" + memberValue() + "')") {crossValue('CUBE_DAILY_CALLS.DAILY_CALLS','M_RATING@AVG')}; 
}
Note

It is recommended to get familiar with crossValue formula before proceeding with this tutorial. As crossValue will not take drill downs applied in the context view.

In this table below, now Product is being placed as the first level of drill downs, and then Employee Name is the second level. Avg. Benchmark is still the overall employee average on the product. Changing the order of the drill downs will make calculating *Avg. Benchmark" a little bit different.

ilupng
Avg_2

The code is as below:

Code Block

double benchmark = 0; 
if(equals(substringBefore(memberValue(), ' '), 'Product') 
   || isBlank(memberValue())) { 
  benchmark = M_RATING@AVG; 
}else { 
  benchmark = prev('M_RATING@AVG',1); 
} 

return benchmark

Next Steps

List siblings
Sv translation
languageja

表では少ないドリルダウンを使い、異なるレベルのインディケーター平均を計算したい場合は多いでしょう。

Note

このチュートリアルに進む前に、memberValue機能とcrossValue機能を十分参照することをお勧めします。

以下の表では、2つのドリルダウンレベル(従業員名と製品)をご確認頂けます。Avg. Ratingはその製品の従業員の平均レートを計算します。

ilupng
Avg_1
しかし、Avg.Benchmark列にあるように、ベンチマークとして、その製品の従業員平均レート同製品の従業員全体のレートと比較したい場合があるでしょう。これは条件的フォーマッティングとして追加することができ、その製品の従業員の平均レートが同製品の従業員全体のレートよりも高い場合、緑で表示し上向き矢印として表示できます。

計算方法は以下の通りです。

Code Block
if(!equals(substringBefore(memberValue(), ' ') ,'Product')) { 
  return ''; 
} else { 
  filter("L_PRODUCT in ('" + memberValue() + "')") {crossValue('CUBE_DAILY_CALLS.DAILY_CALLS','M_RATING@AVG')}; 
}
Note

このチュートリアルに進む前に、crossValueフォーミュラを十分参照することをお勧めします。crossValueはコンテクストビューに適用されているドリルダウンは持ち込みません。

以下の表では、製品がドリルダウンの1番目のレベルとして置かれており、2番目のレベルに従業員名が置かれています。ベンチマークの平均はまだその製品の全従業員の平均です。ドリルダウン順の変更は"Avg. Benchmark"の計算の仕方を少し変えます。

ilupng
Avg_2
コードは以下の通りです:

Code Block
double benchmark = 0; 
if(equals(substringBefore(memberValue(), ' '), 'Product') 
   || isBlank(memberValue())) { 
  benchmark = M_RATING@AVG; 
}else { 
  benchmark = prev('M_RATING@AVG',1); 
} 

return benchmark

次に

List siblings