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

How to count Due Date?

Hi everyone,

Is it possible to count how many due date already passed or encountered? Please find sample table and desired output (Count of Due Date column) below:

Due DateCurrent DateCount of Due Date
1/1/201412/31/20130
1/1/20141/1/20141
1/1/20141/31/20141
1/1/20142/1/20142
1/1/20142/25/20142
1/1/20143/1/20143
1/5/20141/4/20140
1/5/20141/5/20141
1/5/20142/3/20141
1/5/20142/5/20142
1/5/20143/1/20142
1/5/20143/5/20143
1/5/20143/6/20143
1/5/20143/15/20143

Above shown that there are two due dates (Jan 1, 2014 and Jan 5, 2014). Also, find below the conditions:

If Current Day < Due Date, then it's 0.

If Current Day > Due Date, then it's 1 or 2 or 3 or 4

It's so tricky because you have to compare the date, month, and year as well. I don't know yet how to solve this one.

If there's quickest way or simpler way to solve this, please don't hesitate to extend help. Thank you in advance!

Best Regards,

Bill

3 Replies
Sokkorn
Master
Master

Hi Bill

Can you specific condition below? When it become 1? When it become 2?...

If Current Day > Due Date, then it's 1 or 2 or 3 or 4

Regards,

Sokkorn

bill_mtc
Partner - Creator
Partner - Creator
Author

What I meant is this,

Say for example the due date is 1/5/2014, and today is 2/20/2014

This means that, we already have 2 due dates past, 1/5/2014 and 2/5/2014

That's why I'm getting hard on that scenario. But I'm looking for possible solutions.

Sokkorn
Master
Master

Hi Bill,

Maybe this expression can do this job

If(CurrentDate<DueDate,0,

((Year(CurrentDate)*12)+Month(CurrentDate)) - (((Year(DueDate)*12)+Month(DueDate)))+1

)

Regards,

Sokkorn