Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Newbie question about group by()

Hello community

I'm sort of new in development.

The thing is should I insert some calculation function in all field except grouping field? Like max(field1), maxstring(field2), max(field3) from .... group by field4, field5.

Is there any other better solution of group data?

Regard Muncho

7 Replies
yasus
Contributor III
Contributor III

Hi Muncho,

you could try a distinct load...

Not applicable
Author

Hello Gregor,

Distinct load doesn't fit my case.

But thanks

erichshiino
Partner - Master
Partner - Master

Hi, Muncho

Not sure if I understood your question...

You can make as you thought:

load max(field1), maxstring(field2), max(field3), field4, field5

from .... group by field4, field5;

As you would do on a sql database...

You you give us more details or a sample we can provide a more detailed answer.

Hope it helps,

Erich

Not applicable
Author

Let's say i have below fields

userID, last_name, first_name, age, gender, address1, address2, address3, phone, country, postal_code...

Ok, now i need to group them by userID using group by clause. So i need to use max() or count() in every field right?

I just want to know is there better way to do this.

BTW sorry for my bad English.

Not applicable
Author

Yes, i know i need to tell QV which field to use in grouping.

But i know there is better way which i don't know.

Please open my eyes little bit

erichshiino
Partner - Master
Partner - Master

You have to do it if you want to group data but maybe you can create different rules, for example, keep only the last record for one userID, only the first, etc

In those cases, I would create a table with flags depending on the condition, apply those flags back in the main table using left join and then use resident load to keep only the values that matched the flag.

I'm not sure if you can apply it on your model.

Not applicable
Author

Thanks Gregor and Erich.

I got something on your posts.