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

Announcements
Qlik and ServiceNow Partner to Bring Trusted Enterprise Context into AI-Powered Workflows. Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Subtracting dates

Hi,

In the attached QVW for the field "DeliveryDate" I want to subtract the minimum date from the maximum date for a given container number.

It doesn't work. I'm pretty sure it is because of the date format. Any suggestions what I'm doing wrong? Source html files attached as well.

BR. Jakob

Labels (1)
1 Solution

Accepted Solutions
Not applicable
Author

Hi,

you just have to change your loading script as follows to match the string date format

LOAD [Contnr ID],

      date(date#(Deliv.Date,'DD.MM.YYYY')) as DeliveryDate,

      //Containers

     Today() as ExtractDate

FROM

.....

View solution in original post

2 Replies
christophebrault
Specialist
Specialist

hi,

Yes, your problem is because of date format.

See attachef file

if you have a PE edition :

Script :

Containers:

LOAD [Contnr ID],

     SubField( Deliv.Date,'.',3)&'-'&SubField(Deliv.Date,'.',2)&'-'&SubField( Deliv.Date,'.',1) as DeliveryDate,

     Containers,

     left(SubField(FileName(),'-',3),4)&'-'&SubField(FileName(),'-',2)&'-'&right(SubField(FileName(),'-',1),2) as ExtractDate

FROM

   // Change with your path

(html, codepage is 1252, embedded labels, table is @1);

expression in graph :

MinDate:

date(min(DeliveryDate))

MaxDate:

date(max(DeliveryDate))

Difference :

MaxDate-MinDate

Inscrivez vous à ma Newletter Qlik
DoNotMissQlik- Connect with me on Linkedin
Not applicable
Author

Hi,

you just have to change your loading script as follows to match the string date format

LOAD [Contnr ID],

      date(date#(Deliv.Date,'DD.MM.YYYY')) as DeliveryDate,

      //Containers

     Today() as ExtractDate

FROM

.....