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

Finding difference between two dates

Dear Guru's

In the script Select Statement how we will find diffence with currdate() -datefield as DiffDate.

example: CurrDate()-DueDate as DiffDate.

Please help me...

Regards

Joe

14 Replies
Not applicable
Author

Dear Vijay,

As advised by you the script is working fine, still I have a problem in the Due Date, as I need the data of DATEDIFF because in the QVD I would like to store the differnce of today and duedate.

Any Workaround....

Trend:

Load

CORP,

SUB,

LOC,

PRON,

Rupee,

Today()-DATE(DueDate) AS DATEDIFF;

SQL SELECT

CORP,

SUB,

LOC,

Count(PRON) as Inv,

Sum(Rupee) as Amount,

Duedate

FROM S104F31D.REDFW6 Group by CORP,SUB,LOC,DueDate;

 

Store Trend into Test.qvd;

vijay_iitkgp
Partner - Specialist
Partner - Specialist

Try This:

Trend:

Load

CORP,

SUB,

LOC,

DATEDIFF,

Count(PORN) AS Invoice,

Sum(Rupee) AS AMount

Group By

CORP,

SUB,

LOC,

DATEDIFF;

Load

CORP,

SUB,

LOC,

PRON,

Rupee,

Today()-DATE(DueDate) AS DATEDIFF;

SQL SELECT

CORP,

SUB,

LOC,

PRON,

Rupee,

Duedate

FROM S104F31D.REDFW6 ;

 

Store Trend into Test.qvd;

Regards

Vijay

Not applicable
Author

Dear Vijay,

Is it that am I missing anything the Load in between Load

First I am getting a errror as in the following and now I got the differnce of Due date but the Count(OHHPRON), Sum(OEURO) is not showing the count and sum.

Syntax error, missing/misplaced FROM:

Trend:

 

Load

OHHCORP,

OHHSUB,

OHHLOC,

OHHPRON,

OEURO,

DATEDIFF,

Count(OHHPRON) as Inv,

Sum(OEURO) as Eur,

Group By OHHCORP,OHHSUB,OHHLOC,DATEDIFF

Trend:

Load

OHHCORP,

OHHSUB,

OHHLOC,

OHHPRON,

OEURO,

DATEDIFF,

Count(OHHPRON) as Inv,

Sum(OEURO) as Eur,

Group By OHHCORP,OHHSUB,OHHLOC,DATEDIFF

This is the one I tried ....

Trend:

Load

OHHCORP,

OHHSUB,

OHHLOC,

OHHPRON,

OEURO,

DATEDIFF,

Count(OHHPRON) as Inv,

Sum(OEURO) as Eur,

Group By OHHCORP,OHHSUB,OHHLOC,DATEDIFF;

 

Load

OHHCORP,

OHHSUB,

OHHLOC,

OHHPRON,

OEURO,

Today()-DATE(ODUEDT) AS DATEDIFF;

SQL SELECT

OHHCORP,

OHHSUB,

OHHLOC,

OHHPRON,

OEURO,

ODUEDT

FROM S104F31D.EURDTA.REDFW6;

 

Store Trend into Test.qvd;

Regards

Joe

vijay_iitkgp
Partner - Specialist
Partner - Specialist


You are using comma after Sum(OEURO) AS Eur. Since it is end of statement so do not use coma here.

Regards

Vijay

Not applicable
Author

Dear Vijay,

Thanks for your reply after removing the comma now I am getting a error  of

ODBC read failed

SQL SELECT

OHHCORP,

OHHSUB,

OHHLOC,

OHHPRON,

OEURO,

ODUEDT

FROM S104F31D.EURDTA.REDFW6

I have put Join inbetween two Load statments, that is also not working.

Regards

Joe