Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
Modernize Your QlikView Deployment webinar, Nov. 3rd. REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
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
Highlighted
Specialist II
Specialist II

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
Highlighted
Specialist II
Specialist II

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

Highlighted
Not applicable

plans:

LOAD

TARIFF_PLAN,

count(distinct(IMSI_def)) as talking

resident dtf

group byTARIFF_PLAN

Highlighted
Master II
Master II

write like this

plans:

LOAD Distinct

TARIFF_PLAN,

count( IMSI_def) as talking

resident dtf group by TARIFF_PLAN ;