Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
AndreFrencl
Contributor III
Contributor III

Sum com IF (aggr(

Amigos,

Crie uma expressão que permita especificar todos os IDs e faça parte de uma condição especificada e receba o certificado, sem erro.

= sum (

if (aggr ((sum(VB) / sum(METAVB) -1) <- 0,80, ID)
and 
aggr (sum (VB)> 0, ID)

1,0)
)

vejam essa tabela:

Capturar.PNG

Ele contém 1 ID que está dentro das regras e agora precisa somar em R $ a soma de todos os meses, que dá R $ 2474, como mostra o texto.

O problema é que, ao usar ou filtrar ID e exibir todos os registros que estão nessa regra, ou o  soma não funciona mais . 

função:

= if (
aggr ((sum (VB) / sum (METAVB) -1) <- 0,80, ID)
and
aggr (sum (VB)> 0, ID)
, sum(total <ID> VB)
)

Alguém tem alguma ideia?

Obrigado,

 

André

 

 

Labels (1)
1 Solution

Accepted Solutions
agigliotti
Partner - Champion
Partner - Champion

maybe this:

=sum( aggr( if( (sum(VB)/sum(METAVB)-1) < -0,80 and sum(VB) > 0, sum(total <ID> VB), 0 ), ID ) )

I hope it can helps.

View solution in original post

3 Replies
rubenmarin

Hi, I'm not sure to understand it, but maybe:

Sum(Aggr(
  if((sum (VB) / sum (METAVB) -1) <= 0.80 and sum (VB)> 0
    , sum(VB))
, ID))
agigliotti
Partner - Champion
Partner - Champion

maybe this:

=sum( aggr( if( (sum(VB)/sum(METAVB)-1) < -0,80 and sum(VB) > 0, sum(total <ID> VB), 0 ), ID ) )

I hope it can helps.

AndreFrencl
Contributor III
Contributor III
Author

ooowww!! works, man!!!  it's  is!!!

Many thanks!!