
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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!
Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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))

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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))

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@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!
