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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
piekepotloed
Contributor II
Contributor II

Count with a variable

Hi to you all,

This is my data:

Person          Startdate       Enddate          CourseNumber

320 - mr. x     1-2-2013       15-12-2014        1

523 - mr. y     1-4-2013        23-7-2014         1

320 - mr. x     1-5-2014         1-1-2015          2   

234 - mrs. v     1-6-2014       1-7-2015          1  

varMaxDate = 1-10-2014

This is what I want:

Person                  ActiveCourses  

320 - mr. x               2

523 - mr. y               1

234 - mrs. v             1

This is te expression I use to count the Active Courses: ({$<Enddate={">=$(varMaxDate)"}>}Person)

And this is the result:

Person                  ActiveCourses  

320 - mr. x               0

523 - mr. y               0

234 - mrs. v             0

What's going wrong???

Thanks,

5 Replies
tresesco
MVP
MVP

PF attached qvw.

Not applicable

Hi peter,

Try this for ActiveCourse,

count({$<EndDate={">=$(varMaxDate)"}>}Person)

Not applicable

Hi Peter,

Use the below expression:

Count({$<Enddate={">=$(varMaxDate)"}>}CourseNumber)

Hope this helps.

Thanks

Sabal

VishalWaghole
Specialist II
Specialist II

Hi,

PFA Qvw application file it will help you.

-- Regards,

Vishal Waghole

Not applicable

Peter I think you will also want to take into account the start date or you will end up counting courses which are not yet active

Count({$<Enddate={">=$(varMaxDate)"},Startdate={"<=$(varMaxDate)"}>}Person)