Comportamento de agregação

Olá comunidade

Gostaria de compartilhar um problema que estou enfrentando atualmente para utilizar o PRE_AGG / PRE_FILTER.

Visualmente o problema é da seguinte forma:

Tenho uma tabela que apresenta ano, nome dos estados do brasil e um calculo de porcentagem.
O problema, é quando eu aplico o filtro para aparecer apenas uma UF por vez.
Quando deixo para todas as UFs aparecerem, o valor fica correto.


Mas quando eu aplico o filtro o valor é alterado, trazendo um mínimo . Mesmo eu pedindo o max.

O calculo que eu uso para este caso é da seguinte forma

RANK_LABEL_Tx_Cresc_IDEB_BIANUAL_PERC

ifelse(${Crescimento} = “Percentual” ,({RANK_TAXA_CRESCIMENTO_BIANUAL}-1),NULL)

${Crescimento - É um parametro com duas opções Percentual ou Absoluto

RANK_TAXA_CRESCIMENTO_BIANUAL

ifelse( ${Crescimento} = “Percentual” AND ${CaminhoParaSerOPrimeiroEm} = {ANO_ProxIDEB} ,
1+(
maxOver({CRESC_IDEB_ProxIDEB (BASE APOIO)}, [{ano.2}],PRE_AGG) + 0.1

  • maxOver({IDEB_UltimoIDEB}, [{sg_uf.2}],PRE_AGG)
    )
    / maxOver({IDEB_UltimoIDEB}, [{sg_uf.2}],PRE_AGG),

${Crescimento} = “Absoluto” AND ${CaminhoParaSerOPrimeiroEm} = {ANO_ProxIDEB+1},

(
  maxOver({CRESC_IDEB_ProxIDEB+1 (BASE APOIO)}, [{sg_uf.1},{nivel.1}], PRE_AGG)
  + 0.1
  - {IDEB_UltimoIDEB}
) / 2,

NULL
)

CaminhoParaSerOPrimeiroEm - É um parametro que tem as opções 2025 e 2027

ANO_ProxIDEB
{ANO_UltimoIDEB}+2

ANO_UltimoIDEB
maxOver(ifelse({descricao.1} = “Real”,{ano.1},NULL),[{sg_uf.1}],PRE_AGG)

descricao.1,sg_uf.1 e ano.1 São campos originais da base de dados

CRESC_IDEB_ProxIDEB (BASE APOIO)
maxOver(ifelse(${Crescimento} = “Percentual”, {IDEB_UltimoIDEB (BASE APOIO)} * {CRESC_Tx_Cresc_IDEB_BIANUAL (BASE APOIO)},
${Crescimento} = “Absoluto”, {IDEB_UltimoIDEB (BASE APOIO)} + {CRESC_Tx_Cresc_IDEB_BIANUAL (BASE APOIO)},NULL),[{ano.2},{sg_uf.2}],PRE_AGG)

IDEB_UltimoIDEB (BASE APOIO)
maxOver(ifelse({ano.2} = {ANO_UltimoIDEB} ,{IDEB_RECALCULADO (BASE_APOIO)},NULL),[{sg_uf.2}],PRE_AGG)

IDEB_RECALCULADO (BASE_APOIO)

{in.2}*{ip.2}
/Campos originais da base de dadps/

CRESC_Tx_Cresc_IDEB_BIANUAL (BASE APOIO)
ifelse(${Crescimento} = “Percentual”,

(1 + ({CRESC_ABS_IDEB_CRESCIMENTO (BASE APOIO)} / {CRESC_IDEB_ANO_INICIAL (BASE APOIO)})) ^ (1 / ((abs(${AnoFinalDoCrescimento} - ${AnoInicialDoCrescimento})) / 2))

,
${Crescimento} = “Absoluto”, {CRESC_ABS_IDEB_CRESCIMENTO (BASE APOIO)} / (abs(${AnoFinalDoCrescimento} - ${AnoInicialDoCrescimento}) / 2), NULL )

CRESC_ABS_IDEB_CRESCIMENTO (BASE APOIO)
{CRESC_IDEB_ANO_FINAL (BASE APOIO)} - {CRESC_IDEB_ANO_INICIAL (BASE APOIO)}

CRESC_IDEB_ANO_FINAL (BASE APOIO)
maxOver(ifelse({ano.2} = ${AnoFinalDoCrescimento},{IDEB_RECALCULADO (BASE_APOIO)},NULL),[{sg_uf.2}],PRE_AGG)

CRESC_IDEB_ANO_INICIAL (BASE APOIO)
sumOver(ifelse({ano.2} = ${AnoInicialDoCrescimento},{IDEB_RECALCULADO (BASE_APOIO)},NULL),[{sg_uf.2}],PRE_AGG)

AnoFinalDoCrescimento,AnoInicialDoCrescimento - Parametro com ano

Hi @COSTA,
Apologies for the delayed response on this, it looks like the topic was placed under the technical articles section instead of the Q&A.

Dealing with percentiles in pivot tables can always be tricky since they add in their own aggregation angles by default. If you have set to maximum, it may still be giving you the max but at a different scale than expected due to how the pivot table is put together.

Can you please confirm, Is that entire section below your screenshots all one calculated field? It’s a little hard to tell with some of the text blocking. If so, this is pretty complex scenario to digest through a topic thread. It may be easier to assist if you’re able to upload an anonymized version of your analysis to the Arena view, that way I can gain a better grasp on how the field is working: