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

Count if...

Hi guys im in need of some help here.

I am building a bar chart and want to display two things, tasks that are ontime and tasks that are overdue.

I am using this for ontime and it seems to work ok and give me the right number.

     =COUNT(IF(CLOSED_DATE <= DEADLINE_DATE AND CLOSED_TIME <= DEADLINE_TIME,1))

However when i want to calculate the overdue tasks and use this

     =COUNT(IF(CLOSED_DATE >> DEADLINE_DATE AND CLOSED_TIME >> DEADLINE_TIME,1))

...it doesnt seem to work correctly.

If anyone can tell me where i am going wrong i would be very greatful.

Thanks in advance.

7 Replies
Anonymous
Not applicable
Author

Greater than is just one angled bracket ....

=COUNT(IF(CLOSED_DATE > DEADLINE_DATE AND CLOSED_TIME > DEADLINE_TIME,1))

Jonathan

manideep78
Partner - Specialist
Partner - Specialist

greater than symbol is one angular brace not two angular braces.

use '>' instead of '>>'

jagan
Luminary Alumni
Luminary Alumni

Hi,

Try this expression using Set analysis, since If is a costlier operation.

=Sum({<CLOSED_DATE={'>DEADLINE_DATE AND CLOSED_TIME'} * {'>DEADLINE_TIME' >} 1)

Hope this helps you.

Regards,

Jagan.

manideep78
Partner - Specialist
Partner - Specialist

Try this,

Count({<CLOSED_DATE={">DEADLINE_DATE"},CLOSED_TIME={">DEADLINE_TIME"}>}1)

Not applicable
Author

Neither of those seem to work 😕 i get 1 regarless of how many Tasks there are.

Anonymous
Not applicable
Author

So the problem with your expression is you will only hit true if both the deadline date and deadline time are greater.  You are not counting records that were closed on the deadline date after the deadline time.  Make sense?

You should do a few if checks

     closed_date >= deadline_date AND closed_time > deadline_time

     closed_date > deadline_date

I don't have QV handy but try

=COUNT(IF((CLOSED_DATE >= DEADLINE_DATE AND CLOSED_TIME > DEADLINE_TIME) OR (CLOSED_DATE > DEADLINE_DATE),1))

Anonymous
Not applicable
Author

Hi,

can you please provide test data.

Regards