Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Grouping - count & sum help Post Reply Post New Topic
Author Message
deedeelu
Newbie
Newbie


Joined: 12 Jan 2015
Online Status: Offline
Posts: 3
Quote deedeelu Replybullet Topic: Grouping - count & sum help
     Posted: 14 Jan 2015 at 3:34am
I'm having difficulty figuring this one out. I have records like this

Item no     Piece/carton     Total pieces     Cartons/Skid (calculation)
Z44377-1--     400            16800             42
Z44377-1--     400            16800             42
Z44377-1--     400             4400             11
Z44377-1--     400             8800             22

and I want output of

Z44377-1--                    
2 skid @ 42 ctn @ 400 pcs/ctn   33,600 pcs
1 skid @ 11 ctn @ 400 pcs/ctn    4,400 pcs
1 skid @ 22 ctn @ 400 pcs/ctn    8,800 pcs
                    
                                               46,800

Ideally I would like to group on a concatenation of item no, pieces/carton and cartons/skid so I could do a count of records (number of skids) and sum the pieces. Can you group on a concatenation? Any ideas how I can accomplish this?

Thanks!
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 14 Jan 2015 at 4:50am
do not fall into the trap of trying to display unduplicated data so you can do "simple math".
If you need to display it as such for display purposes only, then that is fine, but displaying data a specific way does not alter it. Any calculations you create in the report need to still account for the real data set (all rows dispalyed or not).
Given that, what do you want you report to look like / do?
Getting sums from duplicated data generally is done via
1- shared variable formulas
or
2 -Running Totals


Edited by DBlank - 14 Jan 2015 at 4:52am
IP IP Logged
deedeelu
Newbie
Newbie


Joined: 12 Jan 2015
Online Status: Offline
Posts: 3
Quote deedeelu Replybullet Posted: 14 Jan 2015 at 5:07am
I work in a warehouse. We have a system that holds records for each skid of an item. We submit a daily report to our customer of the inventory of each item. We need to sum it up by same skid configurations. For example the output that I'm looking for that I listed would tell them that we have 2 full skids @ 16,800/skid + 1 partial skid at 4,400 and 1 partial skid at 8,800 for a total of 46,800 pieces.

If I'm reading the response right I'm not trying to display unduplicated data because there is a record for each skid.

Does this make sense?
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 14 Jan 2015 at 7:26am
It helps explain some.
How, from the data, do you determine if a Skid is full or not. just taking into account what you have shown there is no referenc point that indicates a full skid of for item Z44377-1 is 42 cartons
IP IP Logged
deedeelu
Newbie
Newbie


Joined: 12 Jan 2015
Online Status: Offline
Posts: 3
Quote deedeelu Replybullet Posted: 14 Jan 2015 at 9:15am
Yes you are correct. I do not know if a skid is full but as long as I combine "like" skids that all they need to know.

One thing I failed to say but you might have guessed is that the skid tag (each skid) is unique key of the file. The database is weird. There is a field for pieces per carton and a field for total pieces but nothing for number of cartons. That's why I have to calculate it.

This is the email they send out now. They manually go into the system for each item and have to add it up.

60090 Fusion
40 pallets – 48 ctns @ 90 pcs/ctn

61146 Imperial
3 pallets – 32 ctns @ 100 pcs/ctn
1 pallet – 23 ctns @ 100 pcs/ctn

61193 Lutron
1 pallet – 36 ctns @ 400 pcs/ctn

61196 – 5059298 Lutron 400-3497 Rev A CRB
2 pallet – 42 ctns @ 400 pcs/ctn
1 pallet – 11 ctns @ 400 pcs/ctn
1 pallet – 22 ctns @ 400 pcs/ctn
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 14 Jan 2015 at 9:56am
assuming you want to sort (inside each skid tag) by number of pieces
 
group on skid tag
create a formula field for next level grouping as
totext(table.totalpieces,"00000000000000000000",0) + totext(table.piecespercarton,"00000000000000000000",0)
group on this result
//the padded "0" is for sorting and the number can be reduced or increased based on your data set
suppress GH2 and details
in GF2 do
 
Z44377-1--                     (GH1)
GH2suppressed
Details suppressed
2 skid @ 42 ctn @ 400 pcs/ctn   33,600 pcs (GF2) 
     count any field reset at group 2
     text field 
     calculated field you currently are placing in details just palced in GF2
    Piece/cartoon field
    Sum of TotalPieces field reset at GF2
1 skid @ 11 ctn @ 400 pcs/ctn    4,400 pcs  (GF2)
1 skid @ 22 ctn @ 400 pcs/ctn    8,800 pcs  (GF2)
                     
                                               46,800 (GF1)
               Sum of TotalPieces field reset at GF1


Edited by DBlank - 14 Jan 2015 at 10:00am
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum