English Qlik

Create groups based on metrics (and change it with variables)

Variables are really useful in Qlik. If you wish to create groups based in thresholds, this could be a good way to go.

In the video below I show how to group Countries (for example) based on dynamic values, creating a new dimension that will be using variables to calculate which countries are in which group.

You can download the qvf in the link https://approbato.com/files/VariablesandGroups.qvf

Basically we can apply conditions to verify if a Country belong to a cluster:

If Population> X and GDP >Y , then it belong to Group 1, If not…. (and so on)

We use the Aggr function. Below is the video and the Aggr formula used in this example.

After creating the vX and vY variables, we can use the expression below:

Aggr(
if(
   Sum(GDP)>$(vX)  and Sum(Population)>$(vY)
,
   'Q1' ,

   if(
      Sum(GDP)<=$(vX)  and Sum(Population)>$(vY)
,
      'Q2' ,
       
      if(
      Sum(GDP)>$(vX)  and Sum(Population)<=$(vY)
,
          'Q3' ,
      'Q4')))
,Country)

Leave a Reply

Your email address will not be published. Required fields are marked *