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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Expression/ Difference between Date

Hi! How can I calculate the number of days between two dates? For example from 16.04.2013 to 20.08.2013?

Any suggestions greatly appreciated.

Andrea

22 Replies
Not applicable
Author

Hi Andrea

please check the following. its working

Date# ('20-08-2013,'DD-MM-YYYY')-Date#('16-04-2013','DD-MM-YYYY')

 

 

regards

 

harshal

Not applicable
Author

Hi! How can I write the expression when I want to consider only this interval:

Option A. From 01.06.2013 to 30.09.2013;

Option B. From 01.10.2013 to 28.02.2014;
Thank you for any help you can provide.

Andrea

Not applicable
Author

Thank you for your help!

Not applicable
Author

Can you help me with an example pls?

You can find an example attached.

I really appreciate any help you can provide.

Andrea

Clever_Anjos
Employee
Employee

floor(d2) - floor(d1) number of days between d2 and d1

preminqlik
Specialist II
Specialist II

hi andrea

find attachment

Not applicable
Author

Hi! Thank you for your help!

I'd like to find a way to calculate the number of days between two dates only considering this interval:

Example 1: from 01.01.2013 to 31.12.2013;

Example 2: From 01.06.2013 to 30.09.2013;

Example 3: From 01.10.2012 to 28.02.2013;
Thank you for any help you can provide.

Andrea

jagan
Partner - Champion III
Partner - Champion III

Hi,

Try this script

Data:

LOAD

*,

IF(([Start Date] = Date('01/01/2013') AND [End Date] = Date('31/12/2013')) OR ([Start Date] = Date('01/06/2013') AND [End Date] = Date('30/09/2013')) OR

([Start Date] = Date('01/10/2012') AND [End Date] = Date('28/02/2013')), Interval([End Date] - [Start Date], 'D')) AS DateDiff;

LOAD [N. Company],

     Company,

     Employee,

     [Start Date],

     [End Date]

FROM

(ooxml, embedded labels);

Regards,

Jagan.

preminqlik
Specialist II
Specialist II

for eg :

Example 1: from 01.01.2013 to 31.12.2013;

if((num(date#('31.12.2013','DD.MM.YYYY')))-(num(date#('01.01.2013','DD.MM.YYYY')))>0,

(num(date#('31.12.2013','DD.MM.YYYY')))-(num(date#('01.01.2013','DD.MM.YYYY'))),0)

Not applicable
Author

Date# ('20-08-2013,'DD-MM-YYYY')-Date#('16-04-2013','DD-MM-YYYY')

 

 

regards

 

Datta