Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
karelibarcar
Contributor III
Contributor III

count the highest number of management

Hello everybody,

Hello everyone, I need your help, I have to count the last recorded management for each client, but I do not know how to do it, can you help me? The management that must be counted is the one with the highest Num_Gestion value, but I am using a variable because the client can select any range of dates to obtain the report. Please, your help, I've been trying to solve it for 3 days. Thank you very much

auxilioo.png
The formula found in Intersección is:


count

( Distinct

{

(

(<Num_Cedula_Cliente=P({<Identificador_Campaña={'ID1'}, Descripcion_Gestion=>} Num_Cedula_Cliente)>

*

<Num_Cedula_Cliente=P({<Identificador_Campaña={'ID2'}, Descripcion_Gestion=>}Num_Cedula_Cliente)>

)

)

}

Num_Cedula_Cliente

)

12 Replies
karelibarcar
Contributor III
Contributor III
Author

Hi,

Now, I modified the expression, as you can see I no longer have repeated clients, but the condition that Num_Gestion is equal to the maximum is not fulfilled yet.

Sum(Aggr(

count(distinct

{(

<Num_Cedula_Cliente=P({<Identificador_Campaña={'ID1'}, Descripcion_Gestion=>}Num_Cedula_Cliente)>

*

<Num_Cedula_Cliente=P({<Identificador_Campaña={'ID2'}, Descripcion_Gestion=>}Num_Cedula_Cliente)>

*

<Num_Gestion=P({<Num_Gestion = {'=Aggr($(=Max(Num_Gestion)), Num_Cedula_Cliente)'}>}Num_Gestion)>

)}

Num_Cedula_Cliente)

, Proyecto, Descripcion_Gestion, Num_Cedula_Cliente))

Please, save me!

auxilioo.png

karelibarcar
Contributor III
Contributor III
Author

Thanks for your help.

I had to change the dimension by:

Aggr(FirstSortedValue(Descripcion_Gestion, -Num_Gestion), Num_Cedula_Cliente)

And the measure by:

Sum(Aggr(

count(distinct

{(

<Num_Cedula_Cliente=P({<Identificador_Campaña={'ID1'}, Descripcion_Gestion=>}Num_Cedula_Cliente)>

*

<Num_Cedula_Cliente=P({<Identificador_Campaña={'ID2'}, Descripcion_Gestion=>}Num_Cedula_Cliente)>

)}

Num_Cedula_Cliente)

*

Count(Aggr(FirstSortedValue(Descripcion_Gestion, -Num_Gestion), Num_Cedula_Cliente))

, Proyecto, Descripcion_Gestion, Num_Cedula_Cliente))

Now I have what I wanted.

campbellr
Creator
Creator

Hi Karen

I'm glad you got there in the end. I'm afraid my suggestion hasn't been needed in your end result but I'm glad you have a solution.

Ron