Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Highlighted
amberrebma
New Contributor II

group by

how i use group by in script i use this but this is not working

Directory;

LOAD Acccount,

     SubAccounts

    

 

FROM

Book2.xlsx

(ooxml, embedded labels, table is Sheet1)

group by Account;

Tags (1)
5 Replies
nagaiank
Valued Contributor III

Re: group by

Did you want to 'Order By' ?

pritamb89
Contributor

Re: group by

To use group by in script you need at least a aggr function (SUM,AVG,COUNT)

Directory;

LOAD Acccount,

     SubAccounts ,

     Count(SubAccounts) as NoOfSubAccounts

FROM

Book2.xlsx

(ooxml, embedded labels, table is Sheet1)

group by Account;

Without Aggregation function you will get an error like this

Syntax error

Aggregation expressions required by GROUP BY clause.

alejandrow
New Contributor II

Re: group by

Hi, You only need to use the Group by Clause if you are aggregating the information .

For i.e :

Directory;

LOAD Acccount,

    COUNT(SubAccounts) as QSubAccounts

   

FROM

Book2.xlsx

(ooxml, embedded labels, table is Sheet1)

group by Account;

That wouldn't give you a error message.

If you express with some detail what you want to achieve we can help you out

dwforest
Valued Contributor

Re: group by

If you are just trying to weed out duplicates, you can use DISTINCT

Directory;

LOAD DISTINCT Acccount,

     SubAccounts

   

FROM

Book2.xlsx

(ooxml, embedded labels, table is Sheet1)

;

sasiparupudi1
Honored Contributor III

Re: group by

T1:

LOAD Acccount,

     SubAccounts

   

FROM

Book2.xlsx

(ooxml, embedded labels, table is Sheet1)

T2:

Noconcatenate Load

Account,

SubAccounts

Resident T1

Group By Account;

Drop Table T1;