Skip to main content
Announcements
Introducing a new Enhanced File Management feature in Qlik Cloud! GET THE DETAILS!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Group By Clause

I am trying to use Group By but not getting the desired results. Can you tell me what is wrong in the script.

group by1.PNG.pngGroup By2.PNG.png

Group By3.PNG.png

The sheet object is a table box. Qty and Sales Amount is supposed to total but its not doing that. Any help would be appreciated. thanks

1 Solution

Accepted Solutions
MK_QSL
MVP
MVP

Temp:
Load Product, type, customer, [Sales Amount], Qty From TableName;

Final:
Load type, Customer,  Sum([Sales Amount]) as TotalAmount, Sum(Qty) as TotalQty Resident Temp Group By type, Customer;

Drop Table Temp

View solution in original post

4 Replies
jpenuliar
Partner - Specialist III
Partner - Specialist III

if you wan to have total in an Object, try using a chart instead of table box,

the group by in your script may not be necessary

MK_QSL
MVP
MVP

Temp:
Load Product, type, customer, [Sales Amount], Qty From TableName;

Final:
Load type, Customer,  Sum([Sales Amount]) as TotalAmount, Sum(Qty) as TotalQty Resident Temp Group By type, Customer;

Drop Table Temp

Anonymous
Not applicable
Author

Thank you Manish. Your reply cured the mistake I was making. I am getting to know Qlikview logics now. I am even liking it!

Anonymous
Not applicable
Author

hi All, I am trying to understand optimization whereever applicable. So in this case, precalculating values is better practice than using more expressions. As illustrated here, Table box precalculates sum for qty and revenue. Whereas In pivot table (or any other chart) I am using 2 expressions. so performance wise, table box is better than pivot table if total of qty and sales only were needed. this would specifically be true if there were millions of records. Correct..? Also, I want to make sure what precalculation is. So am I right about script for Table box being it..?

snip.PNG.png