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

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

no of Days Between two days calculation

hi gurus,

i have creation Date,approved date

i want to calculate No of f days

if (credate-approved date )=0,1

and

if (credate-approved date )<0 exclude these rows

and sum(if(credate-approved date ) <0 ,No of days

4 Replies
amit_saini
Master III
Master III

Are,

Try something like this:

Calculating day’s b/w dates:

Syntax: LOAD OpenDate,

CloseDate,

CloseDate-OpenDate   AS     DaysOpen,

Floor((CloseDate-OpenDate)/10)*10 & ' to ' & (Floor((CloseDate-OpenDate)/10)*10+9)    AS Range

Output:

OpenDate

CloseDate

DaysOpen

Range

28/02/2012

02/03/2012

3

0 to 9

07/03/2012

15/03/2012

8

0 to 9

01/01/2012

10/01/2012

9

0 to 9

14/01/2012

24/01/2012

10

10 to 19

11/03/2012

24/03/2012

13

10 to 19

28/04/2012

12/05/2012

14

10 to 19

27/01/2012

11/02/2012

15

10 to 19

08/02/2012

23/02/2012

15

10 to 19

07/01/2012

24/01/2012

17

10 to 19

23/04/2012

11/05/2012

18

10 to 19

30/01/2012

19/02/2012

20

20 to 29

12/03/2012

01/04/2012

20

20 to 29

08/02/2012

29/02/2012

21

20 to 29

09/04/2012

01/05/2012

22

20 to 29

17/02/2012

11/03/2012

23

20 to 29

08/04/2012

03/05/2012

25

20 to 29

24/02/2012

07/04/2012

43

40 to 49

Thanks,

AS

anbu1984
Master III
Master III

if (credate>approved date,credate-approved date,If(credate=approved date ,1))

sujeetsingh
Master III
Master III

Use interval function

if (interval(credate-approved date,d )=0,1,

if (interval(credate-approved date,d )<0 null(),

sum(interval(credate-approved date,d ))))

MK_QSL
MVP
MVP

Load

  *,

  If([creation Date] = [approved date], 1,

  If([creation Date] < [approved date], Interval([approved date]-[creation Date],'d'))) as [No Of Days]

Inline

[

  creation Date,approved date

  01/01/2014, 01/01/2014

  15/10/2014, 05/10/2014

  25/10/2014, 01/11/2014

] Where [creation Date] <= [approved date];