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

Announcements
ALERT: QlikView server communication interruptions following Microsoft Windows Domain Controller security updates
cancel
Showing results for 
Search instead for 
Did you mean: 
abhaysingh
Specialist II
Specialist II

Group by Clause

How to use Group by Clause

i want to show Customer Count In Bucket Analysis.

My sales Buckets are

<10K

>10K to <=30K  and so on

i want to show count of customer who had done sales accordingle,

e.g. if 4 customer did Total sales less than 10K in a month than they should come in Bucket of <10K.

Kindly help.

Labels (1)
6 Replies
Not applicable

You can create bucket by hard coding at script editor

on script editor type

load *,

if(sum(sales)<10,000,'<10k',if(sum(sales)>10000 and sum(sales)<=30000,'>10k to <=30k',>30k)) as bucket,

resident yourtablename;

and create a bar chart and in the dimension add bucket to the dimension field and in the expression tab type following expression

count(Customer)

regards

bhawna

simenkg
Specialist
Specialist

you need a group by clause. If this is the way you want to go, then

if(sum(sales)<10,000,'<10k',if(sum(sales)>10000 and sum(sales)<=30000,'>10k to <=30k',>30k)) as bucket,

resident yourtablename

Group by Customer;

Anonymous
Not applicable

hi Abhay,

U can make use of Class function : Class() to get the result u nid

Regardz,

Vaibz...

tresB
Champion III
Champion III

Use class() (if the classes are qui-distant, else IF)to create the classes in calculated dimension or a new field in the script, then in expression simple count() should work.

abhaysingh
Specialist II
Specialist II
Author

@ script level sum function is giving me error

simenkg
Specialist
Specialist

Because you need group by.

Sum is an aggregate function so it needs a group by statement.

Add Group by Customer

after your FROM clause.