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

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
chrisg
Creator III
Creator III

Group by - Syntax error in the code?

Hi,

I have a syntax error in the code. But unfortunately I can not find the error.

Product:

LOAD * INLINE [

    ID, Artikel

    1, Tee

    2, Milk

    3, Butter

    4, Corn

    5, Burger

    6, Ham

    7, Salt

    7, Salat

    9, Pasta

    8, Cake

    9, Apple

    10, Ice

    9, Water

];

LOAD

       ID,

       Count(ID) AS NumOccures

Resident Product where Count(ID)>=2 Group by ID;

Any hints?

Many Thx

Christoph

Do or Do Not. There is no try!
Labels (1)
1 Solution

Accepted Solutions
michael123
Partner - Creator
Partner - Creator

Use preceiding load:

LOAD *

WHERE NumOccures>=2;

LOAD

       ID,

       Count(ID) AS NumOccures

Resident Product

//where count(ID) >=2

Group by ID;

View solution in original post

3 Replies
michael123
Partner - Creator
Partner - Creator

Use preceiding load:

LOAD *

WHERE NumOccures>=2;

LOAD

       ID,

       Count(ID) AS NumOccures

Resident Product

//where count(ID) >=2

Group by ID;

siddharth_kulka
Creator II
Creator II

Hi Chris,

You cannot use an aggregation expression in the where clause.

You will need to break this into 2 steps, either with a resident or prefix load

Check below workaround:

Product:

LOAD * INLINE

[     ID, Artikel    

1, Tee     2, Milk     3, Butter     4, Corn     5, Burger     6, Ham     7, Salt     7, Salat     9, Pasta     8, Cake     9, Apple     10, Ice     9, Water

];

Final:

load *

where NumOccures>=2;

noconcatenate LOAD       

ID,       

Count(ID) AS NumOccures

Resident Product 

Group by ID;

Regards,

Siddharth

chrisg
Creator III
Creator III
Author

Thank you for the quick response.

Have a nice weekend!

best regards

Christoph

Do or Do Not. There is no try!