Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How to subtract Date

Hi All,

I have a table in which i have Order Logging Date and Request Delivery Date.

I want to subtract Request Delivery Date.- Order Logging Date and add a column no_of_days.

Thanks in advance!!

1 Solution

Accepted Solutions
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Try this.

Load *,Interval([Requested delivery date]-[Order Logging Date],'d') as No_of_Days;

LOAD Date(Date#([Order Logging Date], 'DD/MM/YYYY')) as [Order Logging Date],

     Date(Date#([Requested delivery date], 'DD/MM/YYYY')) as [Requested delivery date]

FROM

File.xlsx

(ooxml, embedded labels, table is Sheet1);

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!

View solution in original post

6 Replies
devarasu07
Master II
Master II

Hi,

Try like below,

load *, Interval(Date([Requested delivery date]-[Order Logging Date]),'d') as DateDiff;

LOAD * INLINE [

    Order Logging Date, Requested delivery date

    02/01/2017, 05/01/2017

    02/01/2017, 05/01/2017

    02/01/2017, 05/01/2017

    07/01/2017, 10/01/2017

    10/01/2017, 15/01/2017

    16/01/2017, 20/01/2017

    16/01/2017, 20/01/2017

    16/01/2017, 20/01/2017

    17/01/2017, 20/01/2017

    17/01/2017, 20/01/2017

    17/01/2017, 20/01/2017

    17/01/2017, 20/01/2017

    27/01/2017, 29/01/2017

    27/01/2017, 29/01/2017

];

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Try this.

Load *,Interval([Requested delivery date]-[Order Logging Date],'d') as No_of_Days;

LOAD Date(Date#([Order Logging Date], 'DD/MM/YYYY')) as [Order Logging Date],

     Date(Date#([Requested delivery date], 'DD/MM/YYYY')) as [Requested delivery date]

FROM

File.xlsx

(ooxml, embedded labels, table is Sheet1);

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
Anonymous
Not applicable
Author

Hi Devarasu,

Thanks for your reply.But i can't get the desired result.Please find attached qvw file.

devarasu07
Master II
Master II

Hi,

in your expression use 'D' instead of 'S'

=Interval(Date([Requested delivery date])-Date([Order Logging Date]),'D')

Capture.JPG

Capture.JPG

Anonymous
Not applicable
Author

Thanks for your reply kaushik.

I tried to get no of days in text object.

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

you want for each item? or difference between minimum and maximum date?

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!