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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
fasibaig
Contributor III
Contributor III

IntervalMatch for two different ranges

Any Thoughts Please.

I would like to use IntervalMatch by satisfying two conditions like

((SEGMENT2 >=  '001' AND SEGMENT2  <= '399') AND

(SEGMENT3  >= '5650' AND SEGMENT3 <= '5670'))

When Interval match is used ONLY for segment3  it works fine (Fig1) but

When I use Interval Match to work for segment2 and segment3  against the GL_BALANCES table it ends up in a circular reference. (Fig2)

Please find the code , diagrams, qvw file for reference

//-Dimensions
SEGMENT1:
LOAD SEGMENT1,
SEGMENT1_DESCRIPTION
FROM [temp_gl_balances.xls]
(
biff, embedded labels, table is Segment1$);

SEGMENT2:
LOAD SEGMENT2,
SEGMENT2_DESCRIPTION
FROM [temp_gl_balances.xls]
(
biff, embedded labels, table is Segment2$);

SEGMENT3:
LOAD SEGMENT3,
SEGMENT3_DESCRIPTION
FROM [temp_gl_balances.xls]
(
biff, embedded labels, table is Segment3$);

HEADERS:
LOAD HEADER_ID,
HEADER_NAME,
CONDITION
FROM [temp_gl_balances.xls]
(
biff, embedded labels, table is Headers$);

//--Facts
GL_BALANCES:
LOAD PERIOD,
CCID,
SEGMENT1,
SEGMENT2,
SEGMENT3,
NET_AMT
FROM [temp_gl_balances.xls]
(
biff, embedded labels, table is GLBalances$);

//--SEGMENT Intervals
SEGMENT2_RANGE:
LOAD //HEADER_ID,    ///-----NOTE  NOTE NOTE---   UNCOMMENTING THIS RESULTS IN A LOOP
     FROM_SEGMENT2,
TO_SEGMENT2
FROM
[temp_gl_balances.xls]
(
biff, embedded labels, table is Segment2_Ranges$);

SEGMENT3_RANGE:
LOAD HEADER_ID,
FROM_SEGMENT3,
TO_SEGMENT3
FROM
[temp_gl_balances.xls]
(
biff, embedded labels, table is Segment3_Ranges$);

//---Interval Match
SEGMENT2_INTERVAL_TAB:
IntervalMatch ( SEGMENT2 )
LOAD FROM_SEGMENT2, TO_SEGMENT2
RESIDENT SEGMENT2_RANGE;

SEGMENT3_INTERVAL_TAB:
IntervalMatch ( SEGMENT3 )
LOAD FROM_SEGMENT3, TO_SEGMENT3
RESIDENT SEGMENT3_RANGE;

Figure - 1

intervalmatchfigure1.PNG.png

How to Avoid this loop (Figure -2 )intervalmatchfigure2.PNG.png

Thanks & Regards

Ishaq

1 Solution

Accepted Solutions
fasibaig
Contributor III
Contributor III
Author

Thanks to Bill for his suggestions.

Issue Resolved using the idea suggested in this link

http://community.qlik.com/blogs/qlikviewdesignblog/2013/04/04/intervalmatch

  Diagram after Solving the Problemintervalmatchfigure3.PNG.png

Attaching the Solved .qvw file

Thanks & Regards

Ishaq

View solution in original post

5 Replies
Anonymous
Not applicable

You need to concatenate your fact tables into a single fact table before doing the intervalmatch().

fasibaig
Contributor III
Contributor III
Author

Dear Bill,

Thanks for the suggestion. There is only one Fact GL_BALANCES and 3 Dimensions,

Segment2 and Segment3 Use the Interval Match Tables.

IntervalMatch works fine if ONLY Segment3 is used independently.

Any ideas how to include the segment2 to satisfy the condition via the IntervalMatch Tables

Example Condition -

((SEGMENT2 >=  '001' AND SEGMENT2  <= '399') AND

(SEGMENT3  >= '5650' AND SEGMENT3 <= '5670'))

Thanks & Regards

Ishaq

Anonymous
Not applicable

Or maybe concatenate something like the attached :

fasibaig
Contributor III
Contributor III
Author

The Loop looks resolved but Data does not appear.

fasibaig
Contributor III
Contributor III
Author

Thanks to Bill for his suggestions.

Issue Resolved using the idea suggested in this link

http://community.qlik.com/blogs/qlikviewdesignblog/2013/04/04/intervalmatch

  Diagram after Solving the Problemintervalmatchfigure3.PNG.png

Attaching the Solved .qvw file

Thanks & Regards

Ishaq