Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Count if Sum between dates

Hello,

I am trying to count the number of locations that have met a monthly goal then divide that count by the total number of locations available. If the total applications submitted within the current month is greater than the monthly application target, count as 1.  Then I want to divide it by the number of total locations.

=count(if(sum({$<ApplicationDate={"$(='>=' & Date(MonthStart(Today())) & '<=' & Date(MonthEnd(Today())))"}>} NewAppCount)>=sum(Application_Targets),1))

/count(distinct LocationName)

=if(aggr(sum({$<ApplicationDate={"$(='>=' & Date(MonthStart(Today())) & '<=' & Date(MonthEnd(Today())))"}>} NewAppCount),MarketName)>=sum(Application_Targets),1)

/count(distinct MarketName)

Sample data:

Header 1Header 2Header 3
LocationApplication CountTarget
A5040
B3540
C3835
D4030
E3535

Using the sample, there are three locations that are greater than or equal to the app target - and the desired output would be 60% of locations have met their current target this month.

Would I need to use the aggr() function to let QlikView evaluate each individual location's application count?

Any help is appreciated,

Phil

1 Solution

Accepted Solutions
sunny_talwar

Based on the criteria you use or >= (greater than and equal to) 4 location meet the criteria for your sample. Check it out

View solution in original post

3 Replies
sunny_talwar

Try this:

=Count(Aggr(If(Sum({$<ApplicationDate={"$(='>=' & Date(MonthStart(Today())) & '<=' & Date(MonthEnd(Today())))"}>} NewAppCount) >= Sum(Application_Targets),1), LocationName))

/

Count(DISTINCT LocationName)

sunny_talwar

Based on the criteria you use or >= (greater than and equal to) 4 location meet the criteria for your sample. Check it out

Anonymous
Not applicable
Author

Thank you for the help and the corrected math.  The expression works perfectly!

Phil