Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
peschu123
Partner - Creator III
Partner - Creator III

How to get intersection of 2 time intervals each from another table?

Hi,

I have 2 tables. Lets call them OUTAGES and PRODUCTION.

To keep it "simple" only the necessary values.

PRODUCTION:

KeyOrderIDStartStopProduction time (h)
11234512:0014:002
11234614:0020:006
31235008:0016:008
41234612:0016:004
51235013:0017:004


OUTAGES:

KeyStartStopOutage Duration (h)
114:0015:001
314:0017:003
513:0013:300.5

Now what I want to get is the net effective production time.

Production Time - Outage Duration

PRODUCTION(FINAL):

KeyOrderIDStartStopProduction timeEff Production Time (h)Outage
11234512:0014:0022No
11234614:0020:0065Yes
31235008:0016:0086(because 1 hour is not in this time interval)Yes
41234612:0016:0044No
51235013:0017:0043.5Yes

Unfortunately I only have a "indirect" link through the key. The case like Key3 happens not very often but it happens...

I think I want to solve this in script, but any solution is appreciated.

Thanks in advance and best regards,

Peter

1 Solution

Accepted Solutions
Gysbert_Wassenaar

See page 17-19 of this document: IntervalMatch and Slowly Changing Dimensions


talk is cheap, supply exceeds demand

View solution in original post

2 Replies
Gysbert_Wassenaar

See page 17-19 of this document: IntervalMatch and Slowly Changing Dimensions


talk is cheap, supply exceeds demand
peschu123
Partner - Creator III
Partner - Creator III
Author

Hey Gysbert thank you for your quick help.

There is even an example for exactly my case(mentioned on page 19.

Awesome! Thank you very much.