Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to calculate a Period with 2 Fields ?

Hello everyone,

I have a table with 4 Columns :


- Shipment Date

- Shipment Time

- Arrival Date

- Arrival Time

Both of my Date columns contain data in such format : MM/DD/YYYY

As for my time Column, the data is represented as : HH:MM

What I am trying to do is to create a metric that would take into account both time and Date for Arrival and Shipment so that it gives back a Shipping Time Value for each entry of my table. If anyone can help I'd be really graceful.
Thanks a lot
Alexandre

16 Replies
Not applicable
Author

Here is my excel table

qlikmsg4u
Specialist
Specialist

Hi Alex,

Try this

Test:

Load *,Round((Timestamp(Date(ArrivalDate)&' '&Time(ArrivalTime),'MM/DD/YYYY hh:mm') - Timestamp(Date(ShippedDate)&' '&Time(ShippedTime),'MM/DD/YYYY hh:mm'))*1440) as Duration;

LOAD [Created Date],

    [Created Time],

    [Issued Date],

    [Issued Time],

    [Shipped Date] as ShippedDate,

    [Shipped Time] as ShippedTime,

    Manifests,

    POU,

    [Req Qty],

    [Issue Qty],

    [Req Qty/Vendor],

    [Issue Qty/Vendor],

    Status,

    [Job Refs],

    Batches,

    [Arrival Date] as ArrivalDate,

    [Arrival Time] as ArrivalTime

FROM

Source

sasiparupudi1
Master III
Master III

Hi Alexandre,

please try below

Interval(timestamp#(Date([Arrival Date],'D/MM/YYYY')& ' ' & Time([Arrival Time],'H:MM'),'D/MM/YYYY HH:MM')-timestamp#(Date([Shipped Date],'D/MM/YYYY')& ' ' & Time([Shipped Time],'H:MM'),'D/MM/YYYY HH:MM'),'H')  as Interval,

Date([Shipped Date],'D/MM/YYYY')& ' ' & Time([Shipped Time],'H:MM') as [Shipped Date Time],

Date([Arrival Date],'D/MM/YYYY')& ' ' & Time([Arrival Time],'H:MM') as [Arrival Date Time];

HTH

Sasi

sasiparupudi1
Master III
Master III

Hi

Any luck?

Sasi

Not applicable
Author

Thanks a lot it gives me the number of minutes between the 2 dates and so I can convert that into hours

Not applicable
Author

Yes it worked with your solution too ! Thx a lot !

qlikmsg4u
Specialist
Specialist

Yes you are right, i calculated duration in minutes..Obviously you can convert these into hours.

If you are satisfied with the answers, please close the discussion so that others will find solutions/answers if they encounter the same situation.