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: 
DMG
Contributor III
Contributor III

Counting rows where field in row equals total data

Hi,

I have a people data table, formatted with the following data

Person, Grade, Manager

Person and Manager are simple text fields, so an entry might be

John Doe, D, Rick Smith
Rick Smith, C, Julie Anon

etc

In a table that shows the users, i would like a count measure of the number of people who report to a manager, for example, in Rick Smith's entry, i would like the "Direct Reports" field to contain the total number of people who have "Rick Smith" in their manager field.

Would appreciate some help achieving this.

To expand on this with a bit more complexity, if i wanted a further field called "Total Resource" that totalled up all of the "Direct Reports" measure would that be possible, e.g

If Manager 1 had 3 direct reports with Manger 1's name in the manager field. and Manager 2 had 5 director reports with Manager 2's name in the manager field, and then Manager 3 was listed as the manager of manager 1 and 2, i would like th total to in the "total resource" field to be 10 (3 for 1, 5 for 2, plus 1 and 2 themselves).

Hope that makes sense, can someone recommend a good book for learning qlik formulas like the ones required for above ?

1 Reply
haskia
Partner - Contributor III
Partner - Contributor III

Hello DMG,

I believe the simplest way would be to build a table chart where you add Manager as Dimension and then add the following formula as Measure:

=count(DISTINCT Person) 

It will return the number of unique persons assigned to to each Manager.

If you are dealing with a large number of entries i would recommend that you place reports, managers and persons in separate tables and connect them via key fields. This will be a lot faster through Qlik's associative engine.