Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION

Segmentation of values with irregular ranges

No ratings
cancel
Showing results for 
Search instead for 
Did you mean: 
vbarbera
Contributor
Contributor

Segmentation of values with irregular ranges

Last Update:

Mar 16, 2017 9:27:46 AM

Updated By:

vbarbera

Created date:

Mar 16, 2017 9:27:46 AM

I was thinking about how to segment the employees of the company according to their age and I found the "Class" function. It is very interesting and very comfortable when the intervals are regular, 5 in 5 or 10 in 10, for example. But when the intervals are different from each other, it does not work well for us.

I think a good solution, which seems to work correctly and is very flexible, is to use the "IntervalMatch" function. It behaves similarly to the Excel Vlookup function.

The magic is in this function that manages to make a relation based on the definition of the intervals.

//Load Employees

employees:

Load * Inline [

Name, Age

Nieves, 21

Enrique, 48

Alberto, 22

Sergio, 23

Pedro, 23

Fran, 18

Víctor, 47

Cervanes, 64

];

// Load intervals or ranges

ageSegmentation:

Load * Inline [

Start, End, Group

18, 20, Young

21, 25, AlmostYoung

26,49, Adult

50,150, Senior

];

// The magic is in this function that manages to make a relation based on the definition of the intervals.

Inner Join IntervalMatch (Age)

Load Start, End

Resident ageSegmentation

I hope this is useful for you

Version history
Last update:
‎2017-03-16 09:27 AM
Updated by: