Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
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

Labels (1)
1 Solution

Accepted Solutions
Nicole-Smith
MVP
MVP

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
MVP
MVP

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!!!