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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Calculate Date Subtraction

I wanted to subtract between dates and the result should be in days.

The data in my excel is

payment_start_date = 01-11-2017

payment_end_date = 30-04-2018

I used the lines that I have found in one the forums.

Interval(((Date#([PAYMENT_END_DATE], 'DD-MM-YYYY'))-Date#([PAYMENT_START_DATE], 'DD-MM-YYYY'))) AS DURATION

But the duration came out not the way I wanted , I have attached the picture.

I need some help as I am quite new with this.

2 Replies
Anil_Babu_Samineni
MVP
MVP

May be this?

=Interval(Date(Date#(PAYMENT_END_DATE, 'DD-MM-YYYY'))-Date(Date#(PAYMENT_START_DATE,'DD-MM-YYYY')),'DD')

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
sunny_talwar
MVP
MVP

This is a good option, but if all the OP needed is number of days, I would just do this without Interval function

Date#([PAYMENT_END_DATE], 'DD-MM-YYYY') - Date#([PAYMENT_START_DATE], 'DD-MM-YYYY') as DURATION