5 Replies Latest reply: Dec 8, 2010 7:40 AM by dvavasis

# Regarding date difference

Dear All,

Can anyone suggest me that how can we calculate the difference between two dates and the answer comes in nos. of days:

is there any function or something else

i will gv u an example that what i want to do ie:.......................................

i hv to calculate "avg payment time"

date 1: 6/26/2008 (is billing date means invoice generate on that date)

date 2: 7/15/2008 (is that date where payment is clear means all payment received on that date)

now, we have to calculate the difference between these two dates means (date2 - date1)

and output comes in "no of days" format. means how much days they will take to clear their bill.

plz tell me the suitable solution ASAP

Regards

Neetu Singh

• ###### Regarding date difference

Hi,

No. date. = [Payment recieved date] - [Invoice Generated Date ]

this will do.

-Sridhar

• ###### Regarding date difference

Hi,

see the attached example.

Maybe you have to use QV functions like Date# and Date to get the right format (see QlikView Help File for further information).

Good Luck!

Rainer

• ###### Re. :Regarding date difference

Hi Neetu,

If your 2 date fields are in date format, the answer is in your question : date3=date2 - date1, and just use avg(date3) to have the "average payment time".

If your date fields are not in date format, put them in date format with a date function...

Hope this helps

• ###### Regarding date difference

you can try this

No of days =interval((date1- date2), 'dd')

-Raghu

• ###### Regarding date difference

Hi Raghu,

I have used interval. While it works 'standalone' when I use an 'and' it brings "havoc"...

if

(interval(('\$(MyDate)'- [Due Date] ), 'dd') <=30,'0-30days') as AgeingDD,

if

(interval(('\$(MyDate)'- [Due Date] ), 'dd') >30 and interval(('\$(MyDate)'- [Due Date] ), 'dd') <=60,'31-60days') as AgeingDD;

why??