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

Announcements
Q&A with Qlik - Qlik Cloud Migration: Questions about migrating to Qlik Cloud? Catch the latest replay!
cancel
Showing results for 
Search instead for 
Did you mean: 
k_burata
Creator
Creator

Interval Match on 2 date ranges in a table

Hi,

I have this table below:

    Capture.PNG

How do you do interval match to a calendar on the 2 date ranges (PStart/PEnd and EmpStart/EmpEnd) located on 1 table?

So when I select date Mar 2016 I should get Emp 1.

Thanks

Labels (1)
1 Solution

Accepted Solutions
swuehl
Champion III
Champion III

Do you want to filter the records where your select point in time is part of both intervals? Then maybe create the intersection of both intervals and use INTERVALMATCH against this new interval (Start and End) only:

LOAD

      Position, PStart, PEnd, Emp, EmpStart, EmpEnd,

      RangeMax(EmpStart, PStart) as Start,

      RangeMin(EmpEnd, PEnd) as End

FROM ...;

View solution in original post

1 Reply
swuehl
Champion III
Champion III

Do you want to filter the records where your select point in time is part of both intervals? Then maybe create the intersection of both intervals and use INTERVALMATCH against this new interval (Start and End) only:

LOAD

      Position, PStart, PEnd, Emp, EmpStart, EmpEnd,

      RangeMax(EmpStart, PStart) as Start,

      RangeMin(EmpEnd, PEnd) as End

FROM ...;