Group By and Sum (1 Viewer)

luzz

Registered User.
Local time
Yesterday, 16:22
Joined
Aug 23, 2017
Messages
346
Hi all, I would like to ask if it is possible to perform group by and sum based on the image i have attach below?
As you can see from the image, I have boxed up the PO,Colour to show you all that in the same PO, there will be duplicate colour. However, the colour has difference pounds and yarns weight and the line is difference.

I use this data to create a unmatched query based on the PO and Line so i am thinking if it is possible to group all the same colour together, and sum the pounds and yarns weight? And at the same time, i can still continue to use PO and Line in unmatched query.
Thank you.
 

Attachments

  • Untitled.png
    Untitled.png
    26 KB · Views: 63

Pat Hartman

Super Moderator
Staff member
Local time
Yesterday, 19:22
Joined
Feb 19, 2002
Messages
43,257
If you want to group and sum, you must eliminate the columns that make a row different. So to group by PO and color and sum pounds, you need to eliminate yarn weight and item number from that query.
 

luzz

Registered User.
Local time
Yesterday, 16:22
Joined
Aug 23, 2017
Messages
346
If you want to group and sum, you must eliminate the columns that make a row different. So to group by PO and color and sum pounds, you need to eliminate yarn weight and item number from that query.

I see~ so it is impossible to perform grouping if there is a column that make them different. But what if the column is related to the field and cannot be remove?
Like for the image below; The GLA fields is tied to the colour thus cannot be remove. Does this means that i cannot perform group by in the report?
 

Attachments

  • Untitled.png
    Untitled.png
    21.6 KB · Views: 54

isladogs

MVP / VIP
Local time
Today, 00:22
Joined
Jan 14, 2017
Messages
18,216
I see~ so it is impossible to perform grouping if there is a column that make them different. But what if the column is related to the field and cannot be remove?
Like for the image below; The GLA fields is tied to the colour thus cannot be remove. Does this means that i cannot perform group by in the report?

No.

If the fields contain different values they will be grouped as separate records. So if you group by your first two fields you can then sum or count the next two field and get one record .... as long as you omit GLA from your query.

GLA is part of your table. Just don't include it in your aggregate query

If you ALSO group by GLA, you will get each record separately as the GLA values are different.

Same applies to your original example.
If you are unclear, just try it yourself
 
Last edited:

plog

Banishment Pending
Local time
Yesterday, 18:22
Joined
May 11, 2011
Messages
11,645
Using your the first image you posted as starting data. What would you like the final data to be? Don't explain it to me, show me what data you expect your query to produce when you feed it the data from the initial image.
 

Pat Hartman

Super Moderator
Staff member
Local time
Yesterday, 19:22
Joined
Feb 19, 2002
Messages
43,257
luzz,
The point of a summary is that details are lost. They don't disappear from the underlying data, they just don't appear in the final results.
 

Users who are viewing this thread

Top Bottom