Qlik Community

Ask a Question

App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Announcements
April 22, 2PM EST: Learn about GeoOperations in Qlik Sense SaaS READ MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
erwinvink
Partner
Partner

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 (2)
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
Partner

Please try something like:

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

erwinvink
Partner
Partner
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)

View solution in original post

jochem_zw
Partner
Partner

See post from Tresesco, that will do the job:

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

erwinvink
Partner
Partner
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.