Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
D19PAL
Creator II
Creator II

How do i do this count in script or expression

Hi,

How do i get this count in a table 

Data

Name, Manager,ID,Class,Position 

John,james,1,art,student

Dan,james,2,art,student

James,simon,3,art,teacher

Tony,peter,4,art,student

I need to count by position, how many Name and Manager have the same Class, 

So group 1 is Class Art John and Dan share a class with their Manager, so I want to show John, Dan and the Manager James.

Table

Class,Position,Total

art,student,2

art,teacher,1

 

Table 2

ID,Name,Class,Count

1, john,art,1

2, Dan,art,1

3,James,art,1

 

Thanks much appreciated 

 

 

 

Labels (1)
12 Replies
D19PAL
Creator II
Creator II
Author

Anyone got any ideas on this?

cquezada87
Contributor III
Contributor III

With a single table you can do everything without having two, now if you have two you must organize the tables in such a way that the IDs do their job in this case place IDs for each class section, teacher, managers etc.

expression = Count (ID_NAME) or Count (DISTINCT ID_NAME)

D19PAL
Creator II
Creator II
Author

Thanks for your reply but this isn't the solution im looking for, what I'm looking for is a lot more complex.

For example, there's a set of rules i need to do to get the count right, i don't want to count everything.

 

cquezada87
Contributor III
Contributor III

you can send the data in excel to see what you have
D19PAL
Creator II
Creator II
Author

Here's the data, only 4 rows

 

Data

Name, Manager,ID,Class,Position 

John,james,1,art,student

Dan,james,2,art,student

James,simon,3,art,teacher

Tony,peter,4,art,student

cquezada87
Contributor III
Contributor III

Are you associating the ID with some other field? because if it is to the class it cannot be consecutive since it is ART for everyone

D19PAL
Creator II
Creator II
Author

I need to count by position, how many Name and Manager have the same Class, 

So group 1 is Class Art John and Dan share a class with their Manager, so I want to show John, Dan and the Manager James.

This gives me 3 out of the four IDs

 

cquezada87
Contributor III
Contributor III

q.png

D19PAL
Creator II
Creator II
Author

Thanks, nearly there, needs to be like this.

 

Class     Position    Count

Art,         student,   2

Art,         teacher,    1

 

Count of 2  = id 1 and 2

Count of1 = id 3

 

Because name and manager have the same class, id 4 doesn't