Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi guys,
im looking for a solution for this problem.
Im tryng to sum if a result of a aggregation return equal to 1.. if its more than 1 its 0.
expression:
sum(
aggr(
if(sum({$<mes_ano={">=$(varDataInicioMes)<=$(vDataFimMes)"}, flag_cpf={'1'}, TOP=>}flag_cpf)=1,1,0)
,cpf_cnpj_ajustado))
after , I divide this value for the total of cpf in the base.
The problem its that sometimes, when should return as 1, come back as 0. I already look multiples post here but im stil stuck.
I need do this on the kpi chart (when I can do multiples filters), not in load script.
thanks.
Hi
Try like below
sum({$<mes_ano={">=$(varDataInicioMes)<=$(vDataFimMes)"}, flag_cpf={'1'}, TOP=>}
aggr(
if(sum({$<mes_ano={">=$(varDataInicioMes)<=$(vDataFimMes)"}, flag_cpf={'1'}, TOP=>}flag_cpf)=1,1,0)
,cpf_cnpj_ajustado))
It didn't work...
I don't know if there is another way to do this.
All I need is caculate de amount of cpf that has only one claim in the base over all cpf in the base (distinct), and it has to be between the dates that are variable. I dont't know if the problem its because the variable dates.
I didn't did this on script because I need filter and see multiples scenarios.
Try This:
Count(
aggr(
if(sum({$<mes_ano={">=$(varDataInicioMes)<=$(vDataFimMes)"}, flag_cpf={'1'}, TOP=>}flag_cpf)=1,1,null())
,cpf_cnpj_ajustado))