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

How can I count the total number of distinct recipients that worked a total of 0-20 hours in 2015?

I am trying to say 'count the total number of distinct recipients that worked a total of 0-20 hours in 2015.' The formula I have only counts the total number of rows (in the excel document) that have less than 20 hous (i.e lets say 'Matt' is recorded in 2 rows, with each row having 15 hours...the formula below counts both those lines as if they were distinct people even though they correspond to the same perosn who would have well over 20 hours).

Count (distinct {$<[Total Hours]={"(>=0 <=20)"}, Year={'2015'}>}  Receipient)

I am hoping i am just missing something simple! I have been scouring forums and trying different things. Thank you for your time and consideration.

1 Solution

Accepted Solutions
Nicole-Smith

Try this (you need to sum the number of hours at the recipient level):

count({<Recipient={'=sum({<Year={2015}>}[Total Hours]) <= 20'}>} distinct Recipient)

If, for some reason, you have negatives or need to include the >=0 portion, you could do so like this:

count({<Recipient={'=sum({<Year={2015}>}[Total Hours]) >= 0'}*{'=sum({<Year={2015}>}[Total Hours]) <= 20'}>} distinct Recipient)

View solution in original post

2 Replies
Nicole-Smith

Try this (you need to sum the number of hours at the recipient level):

count({<Recipient={'=sum({<Year={2015}>}[Total Hours]) <= 20'}>} distinct Recipient)

If, for some reason, you have negatives or need to include the >=0 portion, you could do so like this:

count({<Recipient={'=sum({<Year={2015}>}[Total Hours]) >= 0'}*{'=sum({<Year={2015}>}[Total Hours]) <= 20'}>} distinct Recipient)

malradi88
Creator II
Creator II
Author

Amazing! Thanks Nicole