Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
jose_vargas
Creator
Creator

How to count whit conditional

Hello.... I have a problem.

1. I have this values.

imagen1.jpg

2. I need to count the column "Llamada" but the number cant not repeat and the column "Nombre del agente" have to be null.

If you see the row  4, 5 and 6 its the same number and have a value "Luis Lopez" in column "Nombre del agente" so, this number not enter in the count.

I try with this:

count(distinct if(Clasificacion_llamada='A' and Nombre_del_Agente = '' ,Llamada_ANI))

This work correctly if the column "Nombre agente" were null, but how have a value firts delete this row and count a number i need to not count a numbre because this numbre were a name.

Is that clear?  sorry for my english..

Thanks

5 Replies
Digvijay_Singh

Try with set analysis, as it first updates the record set as per modifiers and then apply count distinct logic, You may need to correct the set stmt formattin -

Count({<Clasificacion_llamada={'A'}, Nombre_del_Agente ={"$(=len(Nombre_del_Agente))=0"}>} distinct Llamada_ANI)

swuehl
MVP
MVP

Maybe like

=count({<Clasificacion_llamada={A}, Llamada_ANI = {"=Count(Nombre_del_Agente)=0"} >} distinct Llamada_ANI)


or


=count({<Clasificacion_llamada={A}, Llamada_ANI = {"=Len(trim(Concat(Nombre_del_Agente)))=0"} >} distinct Llamada_ANI)

swuehl
MVP
MVP

Or maybe add the first filter to the advanced search (depending on your exact requirements), like in

=count({< Llamada_ANI = {"=Count({<Clasificacion_llamada={A}>} Nombre_del_Agente)=0"} >} distinct Llamada_ANI)



jose_vargas
Creator
Creator
Author

Thanks.... .I tried and have other question, how should i use in case i dont want to compare whit the variable "Nombre_del_Agente" and i need to use "CodigoAgente"

imagen2.jpg

This is my original code

count(distinct if(Clasificacion_llamada='A' and Agente_Key = 0 and Duracion_de_abandono > '00:00:05',Llamada_ANI))

But, in case the column "llamada ANI" have a agent_key different a "0" this number llamada_ANI should not enter in the count.

So, for this case the value should be like this.

Quantity for 01/07 :   12

Not count the number "14582098"  (blue color) because one row have a codigoAgente different a "0"

imagen3.jpg

swuehl
MVP
MVP

Maybe lik

count({<Clasificacion_llamada={'A'}, Duracion_de_abandono = {">00:00:05"},Llamada_AN = {"=Sum(Agente_Key)=0"} >} distinct Llamada_ANI)

Basically, use an advanced search with an appropriate aggregation function on the field you want to count.