Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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!
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))
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))