Perform a filter within the condition

Hello, I need your help

I have the metrics below:

ifelse(

(sum({Valor Receita})<4000),(sum({Valor Receita})*0.02)+25,

(sum({Valor Receita})<5501),(sum({Valor Receita})*0.035)+100,

(sum({Valor Receita})<7001),(sum({Valor Receita})*0.04)+200,

(sum({Valor Receita})>=7001),(sum({Valor Receita})*0.045)+300,

I need him to perform the filter according to the return of another measurement

Example:

"Empresa = “A” AND (sum({Valor Receita})<4000),(sum({Valor Receita})*0.02)+25

Hi @GuiFox - Can you please give sample input and expected output. This way we all can understand the problem statement and help you in providing the right solution.

Regards - San

would need something like this:

image

custom aggregation cannot contain “SUM” aggregate fields

try using a sumOver and using PRE_AGG

sumOver({Valor Receita}),[],PRE_AGG)