Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Grouping by formula Post Reply Post New Topic
Author Message
Denise
Newbie
Newbie


Joined: 15 Feb 2010
Online Status: Offline
Posts: 3
Quote Denise Replybullet Topic: Grouping by formula
     Posted: 15 Feb 2010 at 11:58am
My data is such that I get duplicates of some information, so I use a formula to calculate a distinct sum in the footer of each group, and I suppress the details portion. I also calculate the percentage based on the total distinct sum. Now I need to sort all of these records so I get the greatest percentage first, then descend from there.
 
An example (my current report)
(details)Company A   OrderNum1   $100
(details)Company A   OrderNum1   $100
(details)Company A   OrderNum2   $200
(details)Company A   OrderNum3   $50
(footer)Company A, 3 orders, $350  33.33% of total sales
(details)Company B   OrderNum1   $500
(details)Company B   OrderNum1   $500
(details)Company B   OrderNum2   $200
(footer)Company B, 2 orders, $700 66.66% of total sales
 
Total Sales: $1050
 
So I would like to be able to sort on my percentage of total sales, but I am not sure how to approach it as those are calculated WhilePrintingRecords, and uses a distinct sum instead of the regular sum. Looking for any ideas, or even a new approach to displaying this data.
 
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 15 Feb 2010 at 2:56pm
Try and change your report to in options to "Select Distinct Records"
From there you can change your values using the insert Summary functions.
then use the TopN Group sort and set the N to a larger value then you have groups


Edited by DBlank - 15 Feb 2010 at 2:57pm
IP IP Logged
Denise
Newbie
Newbie


Joined: 15 Feb 2010
Online Status: Offline
Posts: 3
Quote Denise Replybullet Posted: 16 Feb 2010 at 7:41am
Choosing distinct records still gives me duplicates because of how the data is setup. Say an order can have multiple companies associated with it. I would only want the order counted once for the overall order total and I would still want to group each company together to show its individual sales, even though those order numbers might appear with another company as well. Does that make sense?
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 16 Feb 2010 at 7:47am
Sorry, I do not know of a way to change your sort order based on a sum that uses previous or next values to get that sum.
 
Perhaps someone else has a solution?
IP IP Logged
Denise
Newbie
Newbie


Joined: 15 Feb 2010
Online Status: Offline
Posts: 3
Quote Denise Replybullet Posted: 16 Feb 2010 at 8:25am
Thanks for the suggestion about the distinct records. I eliminated a couple fields that I was showing, which made the records distinct, so I am getting the correct results now. Thank you!!
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