Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Peleu
Contributor II

nested aggregation not allowed

Boa tarde!

Eu fiz uma tabela que contém em uma das colunas a seguinte expressão:  if((Avg([Margem_%])/Avg(prun_mar/100))>=1,'Dentro da Margem','Fora da Margem'), a qual me retorna se um determinado produto está dentro ou fora da meta de margem.

A minha dúvida é se alguém sabe como fazer dois KPIs que contabilizem quantos dos produtos estão classificados como "Dentro da Margem", e quantos estão como "Fora da Margem".

Fiz algumas tentativas aqui, mas sempre dá o erro do "nested aggregation not allowed".

Desde já, muito obrigado a quem conseguir me ajudar!

Labels (1)
1 Solution

Accepted Solutions
Digvijay_Singh

You need to first aggr the KPI against the dimension, possibly the key dimension like this and then count one of the two values you set it up in the inner condition - 

count(if(

aggr(if((Avg([Margin_%])/Avg(prun_mar/100))>=1,'Inside the Margin','Outside the Margin'),Customer)='Inside the Margin',1,0))

View solution in original post

2 Replies
Digvijay_Singh

You need to first aggr the KPI against the dimension, possibly the key dimension like this and then count one of the two values you set it up in the inner condition - 

count(if(

aggr(if((Avg([Margin_%])/Avg(prun_mar/100))>=1,'Inside the Margin','Outside the Margin'),Customer)='Inside the Margin',1,0))

Peleu
Contributor II
Author

@Digvijay_Singh I tested it here and it worked! Thank you very much for your time and, consequently, for your goodwill!

Good rest of the week to you!