Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
disqr_rm
Partner - Specialist III
Partner - Specialist III

HOW-TO: Get rid of Synthetic key with Interval Match

Hi Guys,

Do you know you can get rid of that synthetic key, which is generated when you use IntervalMatch?

Here is an example of how.

Hope it helps someone.

--------------------------

Category:
LOAD * INLINE [
Desc, from-day, to-day
First, 1, 10
Second, 11, 20
Third, 21, 31
];

Emp:
LOAD * INLINE [
Name, day
A1, 1
A1, 5
A1, 2
A2, 7
A2, 15
A3, 25
];

Left join(Emp)
Intervalmatch(day)
LOAD [from-day], [to-day]
RESIDENT Category;

Left join (Emp)
LOAD * resident Category;
drop table Category;

5 Replies
Not applicable

THX a lot,

this example fits exactly my requirements!

It saved me a lot of time!

Martin

Not applicable

Also helped me loads. Was stuck for days lol Thanks man

Not applicable

Hello Rakesh,

Thanks for the share, Superlike*

Angad

hic
Former Employee
Former Employee

Just be careful... This solution works fine as long as a day belongs to only one range. If you have a situation where one day can belong to several ranges (either intentionally or by mistake) then this solution will cause QlikView to calculate the numbers incorrectly. The solution with the synthetic key always calculates correctly.

Synthetic keys should not always be removed - they are in fact quite good if used correctly. I would not remove this synthetic key. Read more about them here: Synthetic keys.

HIC

hic
Former Employee
Former Employee

PS: My view on IntervalMatch.