Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
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;
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;
Hi
you can use the CLASS function which does it for you
best regards
chris
Thank's!!!! great!!!