Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
cscherer
Contributor
Contributor

group by or cluster?

Hello,

I've got a problem with clustering data. I've got dates and orders and I want to know in the first steps, how many orders I've got per day - this works. In the second step, I want to know how many days I've got with 1-5 orders, 6-10 orders and so on.

It shall look like this:

I attached the .qvw

Thanks in advance,

Clemens

1 Solution

Accepted Solutions
Not applicable

ok try this:

Load Script:

Orders:

LOAD order,

     date,

     article

FROM

C:\test.xls

(biff, embedded labels, table is Sheet1$);

Summary:

Left Join(Orders)

Load date,

          if(count(distinct order)<=5,

                    'days with 1 to 5 orders',

          if(count(distinct order)<=10,

                    'days with 6 to 10 orders',

          if(count(distinct order)<=20,

                    'days with 11 to 20 orders',

          'days with >20 orders'))) as  DayType

resident Orders group by date;

Table:

DayType as dimension

count(distinct date) as Expression

View solution in original post

11 Replies
cscherer
Contributor
Contributor
Author

here is the picture:

qv_cluster.JPG

Not applicable

try

if(count(distinct order)<=5,'5',if(count(distinct order)<=10,'10','Other')) as dimension

cscherer
Contributor
Contributor
Author

thank you, but that is not what I mean. I need the "next step"

15 times <= 5

11 times <=10

...

Not applicable

if(count(distinct order)<=5,'5',if(count(distinct order)<=10,'10',if(count(distinct order)<=20,'20','>20')))) as dimension

Not applicable

or:

if(count(distinct order)<=5,'Days with 1 to 5 orders',if(count(distinct order)<=10,'Days with 6 to 10 orders ',if(count(distinct order)<=20,'Days with 11 to 20 orders','days with >20 orders')))) as dimension

cscherer
Contributor
Contributor
Author

it doesn't work. have you got the .qvw?

Not applicable

ok try this:

Load Script:

Orders:

LOAD order,

     date,

     article

FROM

C:\test.xls

(biff, embedded labels, table is Sheet1$);

Summary:

Left Join(Orders)

Load date,

          if(count(distinct order)<=5,

                    'days with 1 to 5 orders',

          if(count(distinct order)<=10,

                    'days with 6 to 10 orders',

          if(count(distinct order)<=20,

                    'days with 11 to 20 orders',

          'days with >20 orders'))) as  DayType

resident Orders group by date;

Table:

DayType as dimension

count(distinct date) as Expression

cscherer
Contributor
Contributor
Author

that`s it! thank you so much!

cscherer
Contributor
Contributor
Author

Hello,

one more question: is it possible to intricate more than 7 if-formulas? If not, I think I`ll need another solution for my problem...

Thanks,

regards,

cs