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

Count based on several lines with 1 field in common

Hi, I have a database like the one below, and i would like to count in a graph something like the expression below:

      

IDActivity ActionActivityDateResponsableRework Type
1ExecutedAA01/01/2015A-
1VerifiedAA02/01/2015B-
1ReworkAA03/01/2015CRTA
1ExecutedBB04/01/2015D-
2ExecutedAA04/01/2015A-
2VerifiedAA05/01/2015B-
2ReworkAA06/01/2015CRTB
2ExecutedBB07/01/2015D-

For the same ID,

IF Responsible = "A" for Activity Action "Executed", and Activity Action "Verified" has data in Date Field,  and Activity Action "Rework" has Rework Type = "RTA" , Count 1

I am trying to do this with Set Analisys, but i am starting now to understand how it works.

BR//Marcelo Fonseca

1 Solution

Accepted Solutions
ramoncova06
Specialist III
Specialist III

I would suggest using a crosstable to activity action type in a regular dimension so you could join the data and create a single entry by row, this is how to do it at the front end

count({

<ID=P({<[Activity Action] = {'Executed'}>}),Responsable = {'A'}>

*

<ID=P({<[Activity Action] = {'Verified'}, ID = {"=nullcount(Date)=0"}>}) >

*

<ID=P({<[Activity Action] = {'Rework'}, [Rework Type] = {'RTA'} >} ) >

}ID)

View solution in original post

4 Replies
ramoncova06
Specialist III
Specialist III

I would suggest using a crosstable to activity action type in a regular dimension so you could join the data and create a single entry by row, this is how to do it at the front end

count({

<ID=P({<[Activity Action] = {'Executed'}>}),Responsable = {'A'}>

*

<ID=P({<[Activity Action] = {'Verified'}, ID = {"=nullcount(Date)=0"}>}) >

*

<ID=P({<[Activity Action] = {'Rework'}, [Rework Type] = {'RTA'} >} ) >

}ID)

Not applicable
Author

Hi Ramon, I could not get the results. Does the second line should't be like this?

<ID=P({<[Activity Action] = {'Executed'}>}),Responsable = {'A'}>})>

ramoncova06
Specialist III
Specialist III

no, the why I added it should work fine see attached example

Not applicable
Author

Thats right Ramon, i got it here! But one thing didnot work like i Expected. I need to filter the field "Responsible" for example, if choose A, it counts 1. If i Choose any other, it counts 0. But when i choose A it counts 0 either way.