Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
GeromA
Contributor II
Contributor II

Create new category dimension based on field values

Hi all,

 

I'd like to create a dimension in QS to help me categorizing my customers into clusters. Unfortunately, I keep getting the 'invalid dimension' error.

I have a table like this:

CustomerConsumption
Customer A10000
Customer B420000
Customer C900000
Customer D65000
Customer E135000
Customer F152000
Customer G7000
Customer H

3530

 

The clustering formula should do the following:

=if([Consumption]<12001,'0 - 12.000',

if([Consumption]<75001,'12.001 - 75.000',

if([Consumption]<180001,'75.001 - 180.000','180.001 - 1.500.000')))

In addition, there are two limiting criteria that are needed to identify whether the consumption is to be counted.

The final result should look like this:

ClusterCustomerConsumption
0 - 12.000Customer A10000
180.001 - 1.500.000Customer B420000
180.001 - 1.500.000Customer C900000
12.001 - 75.000Customer D65000
75.001 - 180.000Customer E135000
75.001 - 180.000Customer F152000
0 - 12.000Customer G7000
0 - 12.000Customer H3530

 

Many thanks for your solutions.

Best,

GeromA

1 Solution

Accepted Solutions
agigliotti
Partner - Champion
Partner - Champion

Hi @GeromA ,

You should add a calculated dimension as below:

aggr( if( sum(Consumption)<12001, '0 - 12.000',
if( sum(Consumption)<75001, '12.001 - 75.000',
if( sum(Consumption)<180001, '75.001 - 180.000', '180.001 - 1.500.000' ))), Customer )

I hope it can helps.
Best Regards

View solution in original post

2 Replies
agigliotti
Partner - Champion
Partner - Champion

Hi @GeromA ,

You should add a calculated dimension as below:

aggr( if( sum(Consumption)<12001, '0 - 12.000',
if( sum(Consumption)<75001, '12.001 - 75.000',
if( sum(Consumption)<180001, '75.001 - 180.000', '180.001 - 1.500.000' ))), Customer )

I hope it can helps.
Best Regards

GeromA
Contributor II
Contributor II
Author

Hi @agigliotti ,

 

thanks, this finally did the trick.

 

Best,

GeromA