Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Not applicable

Group by with where clause

Hello,

Is there a way to use group by the same time as where clause?

I'd like to group by field1, resident Table1, but where field2 is 1, and field3 is 4.

1 Solution

Accepted Solutions

Re: Group by with where clause

May be this:

NewTable:

Load

    field1,

    Sum() as [SumC] 

Resident [Table1]

Where field2 = 1 and field3 = 4

Group by field1;

View solution in original post

5 Replies
MVP & Luminary
MVP & Luminary

Re: Group by with where clause

Yes, you can use both a WHERE and an GROUP BY clause in the same load statement.

LOAD A, B, sum(C) as C

FROM ABC

WHERE C > 0

GROUP BY A, B

;


talk is cheap, supply exceeds demand
Not applicable

Re: Group by with where clause

I am doing this using a load resident, where can I put the where clause?

NewTable:

Load

     field1, 

     Sum() as [SumC]  

     Resident [Table1]

Group by

     field1;

Now where to add below?

where field2=1 and field3=4

MVP & Luminary
MVP & Luminary

Re: Group by with where clause

NewTable:

Load

     field1,

     Sum() as [SumC] 

Resident

  [Table1]

Where

  field2=1 and field3=4

Group by

     field1

  ;


talk is cheap, supply exceeds demand

Re: Group by with where clause

May be this:

NewTable:

Load

    field1,

    Sum() as [SumC] 

Resident [Table1]

Where field2 = 1 and field3 = 4

Group by field1;

View solution in original post

MVP & Luminary
MVP & Luminary

Re: Group by with where clause

If you are dealing with large datasets you should better separate where and group by in two loadings - it will be much faster to filter at first the data and then to aggregate them.

- Marcus