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

Count all rows in selection if one is flagged

Hey all,

Just a simple question but I can't get it working. I have a table with the columns "Employee ID", "Date" and "Flag Leave". The flag is a 1 or 0 and tells if someone was leaving in a period or not. I want to count all the days of an employee in a selected period if one or more days in the selection are flagged.

This should be done in the frontend and not in the script editor because the selection of periods is flexible. I have tried AGGR but it's a dataset with 6000 employees and about 900 dates per employee so it was to performance heavy but maybe I did something inefficient.


Have anyone an idea how to solve this?

Thanks in advance

Labels (1)
1 Solution

Accepted Solutions
tresesco
MVP
MVP

Try with p(). Something like:

 

Count({$<Employee=p({<Flag={1}>} Employee)>}Date)

View solution in original post

5 Replies
jochem_zw
Partner Ambassador
Partner Ambassador

Please try something like:

Count({$<Flag={1}>}Date)

erwinvink
Partner - Contributor II
Partner - Contributor II
Author

Hi Jochem, thanks for taking time. This will not work because I want to count all the days of en employee if one (or more) is flagged. With the expression you give, only the flagged days itself will be count.

tresesco
MVP
MVP

Try with p(). Something like:

 

Count({$<Employee=p({<Flag={1}>} Employee)>}Date)

jochem_zw
Partner Ambassador
Partner Ambassador

See post from Tresesco, that will do the job:

Count({$<Employee=p({<Flag={1}>}Employee)>}Date)

erwinvink
Partner - Contributor II
Partner - Contributor II
Author

Hi Tresesco and Jochem,

This is working great. The P() function is kind of new for me. Good for me to get some knowledge of it. Thanks for your help.