No Translation available yet
You have Slovak selected as language but this page has not been translated yet. Translate the page or view the content in the default space language below.
Display default
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.
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.
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.
if(!equals(substringBefore(memberValue(), ' ') ,'Product')) {
return '';
} else {
filter("L_PRODUCT in ('" + memberValue() + "')") {crossValue('CUBE_DAILY_CALLS.DAILY_CALLS','M_RATING@AVG')};
}
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.
The code is as below:
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