Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Dúvida sobre Agregação

Olá a todos!

Tendo a expressão Max(Aggr(Sum(Vendas),Mês)) irá me retornar o maior valor de vendas em um mês. Eis a minha dúvida, como é possível retornar o mês onde teve a maior venda?

Obrigado a todos!

Labels (1)
1 Solution

Accepted Solutions
nicolett_yuri

Sua expressão vai retornar o maior valor de vendas que teve em um mês.

Para retornar o valor do maior mês, você deve utilizar a função FirstSortedValue.

Segue um exemplo em anexo.

LOAD * INLINE [

MES, VALOR

1, 1

1, 1

2, 2

2, 1

3, 5

3, 2

4, 8

5, 10

6, 5

6, 1

];

=firstsortedvalue(MES, -aggr(sum(VALOR), MES))

View solution in original post

1 Reply
nicolett_yuri

Sua expressão vai retornar o maior valor de vendas que teve em um mês.

Para retornar o valor do maior mês, você deve utilizar a função FirstSortedValue.

Segue um exemplo em anexo.

LOAD * INLINE [

MES, VALOR

1, 1

1, 1

2, 2

2, 1

3, 5

3, 2

4, 8

5, 10

6, 5

6, 1

];

=firstsortedvalue(MES, -aggr(sum(VALOR), MES))