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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
gabroteddy
Contributor III
Contributor III

How to count switch and first occurrences

Hi,

i have a table like this...with much more rows.

 

namesurnamedateofbirthresultDATA VALIDAZIONE
PROVAPROVA116/12/1938POSITIVO09/04/2020
PROVAPROVA205/06/1941POSITIVO10/04/2020
PROVAPROVA319/10/1930POSITIVO11/04/2020
PROVAPROVA116/12/1938POSITIVO12/04/2020
PROVAPROVA205/06/1941NON RILEVATO13/04/2020
PROVAPROVA116/12/1938NON RILEVATO14/04/2020

 

In different dashboards i want calculate:

1) how many times a specific person (identified by nam+surname+dateofbith) have switched theri result (i.e. PROVA PROVA1 have switched once from POSITIVO to NON RILEVATO....)

2) count only the first occurence of a specific result for each person (i.e. PROVA PROVA1 have two result POSITIVO but i want count only the first) 

 

Please help me.

Thx

2 Replies
Saravanan_Desingh

commQV01.PNGAre you looking for this?

tab1:
LOAD name, surname, dateofbirth, Count(DISTINCT result) As Count_Result
Group By name, surname, dateofbirth
;
LOAD * INLINE [
    name, surname, dateofbirth, result, DATA VALIDAZIONE
    PROVA, PROVA1, 16/12/1938, POSITIVO, 09/04/2020
    PROVA, PROVA2, 05/06/1941, POSITIVO, 10/04/2020
    PROVA, PROVA3, 19/10/1930, POSITIVO, 11/04/2020
    PROVA, PROVA1, 16/12/1938, POSITIVO, 12/04/2020
    PROVA, PROVA2, 05/06/1941, NON RILEVATO, 13/04/2020
    PROVA, PROVA1, 16/12/1938, NON RILEVATO, 14/04/2020
];
Brett_Bleess
Former Employee
Former Employee

If Saran's post got you what you needed, we would appreciate it if you would return to the thread and use the Accept as Solution button on their post to give them credit for the assistance and to let other Members know that worked.  If you did something different, please consider posting what you did and then mark that post.

Regards,
Brett

To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question.
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.