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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

using intervalmatch multiply qty and unitprice

tab2

QuantityOrder DateItemID
1030-Jun-001
2030-Jun-991
3004-Jul-001
1003-Dec-992
3007-Apr-002
2007-Jul-002
4009-Jan-002
1010-Jun-003
2011-Jul-993
3012-Jul-993
3004-Jul-121
3004-Jul-111

tab1

ItemIDPrice Changed Start DatePrice Changed End DateUnit Price
101-Jul-0004-Jul-0025
101-Jul-9930-Jun-0010
105-Jul-0010-Jul-0026
111-Jul-0005-Aug-0028
106-Aug-0005-Aug-1228
204-Dec-9907-Jan-9930
206-Aug-0006-Oct-0033
207-Jul-0005-Aug-0035
208-Jan-9906-Jul-0028
309-Jun-0009-Jul-0015
313-Jul-9908-Jun-0020
312-Jan-9912-Jul-9921

i want to make qty*unitprice and try to implement interval_match.

please let me know how will i do this.

i am really new in this section. i have writen the following code.

tab1:

LOAD ItemID,

     [Price Changed Start Date] as st_date,

     [Price Changed End Date] as end_date,

     [Unit Price] as unit_price

FROM

..\..\QLIKVIEW\interval_date.xls

(biff, embedded labels, table is actual$);

tab2:

LOAD Quantity as qty,

     [Order Date] as ord_date,

     ItemID

FROM

..\..\QLIKVIEW\interval_date.xls

(biff, embedded labels, table is sold$);

inner join

INTERVALMATCH (ord_date, ItemID)

LOAD

st_date

,end_date

,ItemID

,unit_price

RESIDENT [tab1];

1 Solution

Accepted Solutions
Not applicable
Author

there is sometring strange with date format but i finally made it:)

and second thing check your intervals (one of them ends before start:)) so i use my own tables (similar to your's)

SET DateFormat='DD-MM-YYYY';

tab1:

LOAD * INLINE [

ItemID, st_date, end_date, unit_price

1, 01-07-1999, 30-06-2000, 10

1, 01-07-2000, 04-07-2000, 25

1, 05-07-2000, 10-08-2000, 26

1, 11-08-2000, 05-08-2012, 28

2, 08-01-1999, 06-07-2000, 28

2, 07-07-2000, 05-08-2000, 35

2, 06-08-2000, 06-10-2000, 33

3, 12-01-1999, 12-07-1999, 21

3, 13-07-1999, 08-01-2000, 20

3, 09-01-2000, 09-07-2000, 15

];

tab2:

LOAD * INLINE [

ItemID, ord_date, qty

1, 30-06-2000, 10

1, 30-06-1999, 20

1, 04-07-2000, 30

2, 03-12-1999, 10

2, 07-04-2000, 30

2, 09-01-2000, 40

3, 10-01-2000, 10

3, 11-07-1999, 20

3, 12-07-1999, 30

];

final:

IntervalMatch ( ord_date, ItemID ) load st_date, end_date, ItemID  resident tab1;

left join load ItemID,          ord_date, qty resident tab2;

left join load st_date, end_date, unit_price resident tab1;

drop table tab1, tab2;

left join load ItemID, ord_date, qty*unit_price resident final;

View solution in original post

2 Replies
Not applicable
Author

there is sometring strange with date format but i finally made it:)

and second thing check your intervals (one of them ends before start:)) so i use my own tables (similar to your's)

SET DateFormat='DD-MM-YYYY';

tab1:

LOAD * INLINE [

ItemID, st_date, end_date, unit_price

1, 01-07-1999, 30-06-2000, 10

1, 01-07-2000, 04-07-2000, 25

1, 05-07-2000, 10-08-2000, 26

1, 11-08-2000, 05-08-2012, 28

2, 08-01-1999, 06-07-2000, 28

2, 07-07-2000, 05-08-2000, 35

2, 06-08-2000, 06-10-2000, 33

3, 12-01-1999, 12-07-1999, 21

3, 13-07-1999, 08-01-2000, 20

3, 09-01-2000, 09-07-2000, 15

];

tab2:

LOAD * INLINE [

ItemID, ord_date, qty

1, 30-06-2000, 10

1, 30-06-1999, 20

1, 04-07-2000, 30

2, 03-12-1999, 10

2, 07-04-2000, 30

2, 09-01-2000, 40

3, 10-01-2000, 10

3, 11-07-1999, 20

3, 12-07-1999, 30

];

final:

IntervalMatch ( ord_date, ItemID ) load st_date, end_date, ItemID  resident tab1;

left join load ItemID,          ord_date, qty resident tab2;

left join load st_date, end_date, unit_price resident tab1;

drop table tab1, tab2;

left join load ItemID, ord_date, qty*unit_price resident final;

Anonymous
Not applicable
Author

thanks prai.

i have another query may be not required right now.

if stdat and enddate stored into a single column then how will i pick the

value.

itemid dt unitprice

1 01-07-1999 10 -- 1/7 to 29/6 value would be 10

1 30-06-2000 20

tab2 same as above.....

On Thu, Jul 26, 2012 at 1:00 AM, Pari Pari <