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

Date difference

Hello

I'm doing some data validation on two date fields that should be one year apart and found something interesting.  I use Date1-date2 and was expecting to get either 365 or 366, however I got some non integer as well. Any idea why?

Date 1

Date 2

=Date1 - Date2

12/22/2012

12/22/2011

366

10/16/2014

10/16/2013

365

10/19/2014

10/19/2013

365

10/23/2014

10/23/2013

364.303588

1/7/2015

1/7/2014

364.3483333

1/15/2015

1/15/2014

365

1 Solution

Accepted Solutions
sergiorey
Partner - Creator
Partner - Creator

Hi,

May be it is taking hour/minutes/seconds in consideration.
Please try using Floor function so as to consider only the date, like this:

Floor([Date 1]) - Floor([Date 2])

Regards,

Sergio.

View solution in original post

3 Replies
sinanozdemir
Specialist III
Specialist III

I am getting all integers:

Capture.PNG

sergiorey
Partner - Creator
Partner - Creator

Hi,

May be it is taking hour/minutes/seconds in consideration.
Please try using Floor function so as to consider only the date, like this:

Floor([Date 1]) - Floor([Date 2])

Regards,

Sergio.

sinanozdemir
Specialist III
Specialist III

Or can just use Interval():

Capture.PNG