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

Grouping SAles

Hi everyone,

I have a table with the Custaccount and number of sales, with the following Script. I would like to group the sales like

number of sales  Clasification

0-1                    A

6-10                  B

11-15               C

OLEDB CONNECT TO $(QsgConAX);

[SALES_COUNTER]:

LOAD

   

     CUSTACCOUNT,

                    count( distinct [SALESID] ) AS SALES_COUNTER WHERE WildMatch([SALESID], 'PV00*')

GROUP BY CUSTACCOUNT ;

SQL Select AX_SQL_SALESTABLE_2012.SALESID, AX_SQL_SALESTABLE_2012.CUSTACCOUNT From AX_SQL_SALESTABLE_2012;

Thank's!!!

Eduard

1 Solution

Accepted Solutions
Nicole-Smith

You should be able to add code (after what you already have) such as:

LEFT JOIN (SALES_COUNTER)

LOAD DISTINCT

     SALES_COUNTER

     if(SALES_COUNTER >= 0 and SALES_COUNTER <= 1, 'A',

     if(SALES_COUNTER >= 6 and SALES_COUNTER <= 10, 'B',

     if(SALES_COUNTER >= 11 and SALES_COUNTER <= 15, 'C'))) as Classification

RESIDENT SALES_COUNTER;

View solution in original post

3 Replies
Nicole-Smith

You should be able to add code (after what you already have) such as:

LEFT JOIN (SALES_COUNTER)

LOAD DISTINCT

     SALES_COUNTER

     if(SALES_COUNTER >= 0 and SALES_COUNTER <= 1, 'A',

     if(SALES_COUNTER >= 6 and SALES_COUNTER <= 10, 'B',

     if(SALES_COUNTER >= 11 and SALES_COUNTER <= 15, 'C'))) as Classification

RESIDENT SALES_COUNTER;

Not applicable

Hi

you can use the CLASS function which does it for you

best regards

chris

ecabanas
Creator II
Creator II
Author

Thank's!!!! great!!!