Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

LOAD Count distinct script

Hi all,

i'm trying to create a new table in a Load Script after loading a file, but i have an "Invalid Expression" error on the Count function.

Could you please help me?

I need to count the number of item for each value of "tariff_plan"..

Here is an extract of the code:

dtf:

LOAD 

     CALLING_IMSI,

     (if(CALLING_IMSI='',CALLED_IMSI, CALLING_IMSI)) as IMSI_def,

     CALLED_IMSI,

     TARIFF_PLAN,     

     if(EVENT_TYPOLOGY='Data',QUANTITY/(1024*1024),QUANTITY) as QUANTITY

     FROM

C:\253.csv

(txt, codepage is 1252, embedded labels, delimiter is ',', msq);

plans:

LOAD

TARIFF_PLAN,

count(distinct(IMSI_def)) as talking

resident dtf;

1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

dtf:

LOAD

     CALLING_IMSI,

     (if(CALLING_IMSI='',CALLED_IMSI, CALLING_IMSI)) as IMSI_def,

     CALLED_IMSI,

     TARIFF_PLAN,    

     if(EVENT_TYPOLOGY='Data',QUANTITY/(1024*1024),QUANTITY) as QUANTITY

     FROM

C:\253.csv

(txt, codepage is 1252, embedded labels, delimiter is ',', msq);

plans:

LOAD

TARIFF_PLAN,

count(distinct(IMSI_def)) as talking

resident dtf

group by TARIFF_PLAN

;

You forgot to add group by statement due to which it was showing error.

Regards

Nitin

View solution in original post

3 Replies
Anonymous
Not applicable
Author

dtf:

LOAD

     CALLING_IMSI,

     (if(CALLING_IMSI='',CALLED_IMSI, CALLING_IMSI)) as IMSI_def,

     CALLED_IMSI,

     TARIFF_PLAN,    

     if(EVENT_TYPOLOGY='Data',QUANTITY/(1024*1024),QUANTITY) as QUANTITY

     FROM

C:\253.csv

(txt, codepage is 1252, embedded labels, delimiter is ',', msq);

plans:

LOAD

TARIFF_PLAN,

count(distinct(IMSI_def)) as talking

resident dtf

group by TARIFF_PLAN

;

You forgot to add group by statement due to which it was showing error.

Regards

Nitin

Not applicable
Author

plans:

LOAD

TARIFF_PLAN,

count(distinct(IMSI_def)) as talking

resident dtf

group byTARIFF_PLAN

er_mohit
Master II
Master II

write like this

plans:

LOAD Distinct

TARIFF_PLAN,

count( IMSI_def) as talking

resident dtf group by TARIFF_PLAN ;