Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
arethaking
Creator II
Creator II

What is interval match.

Hi All,

What is interval match.Please give an example.

Thanks in advance

1 Solution

Accepted Solutions
qlikviewwizard
Master II
Master II

Hi Check this also.

// ==== Load Activities ==================================================

Data:

LOAD * INLINE [Date, Key, Desc

    2010-01-01, A, z1v

    2010-02-01, A, a1v

    2010-03-01, A, z1v

    2010-04-01, A, b1v

    2010-05-01, A, d1v

    2010-06-01, A, e1v

    2010-01-01, B, f1v

    2010-02-01, B, t1v

    2010-03-01, B, k1v

    2010-04-01, B, e1v

    2010-05-01, B, z1v

    2010-06-01, B, a1v];

// ===== Load the Contract ================================================

Contract:

LOAD * INLINE [START_DATE, END_DATE, Key, Value

    2010-01-01, 2010-12-31, A, 5

    2010-01-01, 2010-03-30, B, 3

    2010-04-01, 2010-12-31, B, 4];

// ==== Link Fields from Data with Contract into the Contract-Table ========

INNER JOIN INTERVALMATCH (Date, Key) LOAD START_DATE, END_DATE, Key RESIDENT Contract;

// ==== Join into one Table only, remove contract-Data =====================

JOIN (Data) LOAD * RESIDENT Contract;

DROP TABLE Contract;

DROP FIELD START_DATE, END_DATE;

View solution in original post

4 Replies
sunny_talwar

sunny_talwar

Also, read here

IntervalMatch

balabhaskarqlik

The Interval Match is one of the functions in QlikView that can be used to match a numeric value in a single table, such as date, timestamp, score, percent or any number, to an interval or duration in a second table. The IntervalMatch function discreet data to one or more dimensions that are changing over time. It can be us for resolving slowly changeing dimensions by linking the specific key fields to the appropriate numeric intervals. It can be used with LOAD, Inline and SQL select statements.

Check these:

https://www.c-sharpcorner.com/UploadFile/35fef0/intervalmatch-function-in-qlikview/

Example:

EventLog:

LOAD * Inline [

Time, Event, Comment

00:00, 0, Start of shift 1

01:18, 1, Line stop

02:23, 2, Line restart 50%

04:15, 3, Line speed 100%

08:00, 4, Start of shift 2

11:43, 5, End of production

];

OrderLog:

LOAD * INLINE [

Start, End, Order

01:00, 03:35, A

02:30, 07:58, B

03:04, 10:27, C

07:23, 11:43, D

];

//Link the field Time to the time intervals defined by the fields Start and End.

Inner Join IntervalMatch ( Time )

LOAD Start, End

Resident OrderLog;

https://help.qlik.com/en-US/qlikview/November2017/Subsystems/Client/Content/Scripting/ScriptPrefixes...

qlikviewwizard
Master II
Master II

Hi Check this also.

// ==== Load Activities ==================================================

Data:

LOAD * INLINE [Date, Key, Desc

    2010-01-01, A, z1v

    2010-02-01, A, a1v

    2010-03-01, A, z1v

    2010-04-01, A, b1v

    2010-05-01, A, d1v

    2010-06-01, A, e1v

    2010-01-01, B, f1v

    2010-02-01, B, t1v

    2010-03-01, B, k1v

    2010-04-01, B, e1v

    2010-05-01, B, z1v

    2010-06-01, B, a1v];

// ===== Load the Contract ================================================

Contract:

LOAD * INLINE [START_DATE, END_DATE, Key, Value

    2010-01-01, 2010-12-31, A, 5

    2010-01-01, 2010-03-30, B, 3

    2010-04-01, 2010-12-31, B, 4];

// ==== Link Fields from Data with Contract into the Contract-Table ========

INNER JOIN INTERVALMATCH (Date, Key) LOAD START_DATE, END_DATE, Key RESIDENT Contract;

// ==== Join into one Table only, remove contract-Data =====================

JOIN (Data) LOAD * RESIDENT Contract;

DROP TABLE Contract;

DROP FIELD START_DATE, END_DATE;