Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: formula on group Post Reply Post New Topic
Author Message
mostrador
Newbie
Newbie


Joined: 20 Jul 2010
Online Status: Offline
Posts: 8
Quote mostrador Replybullet Topic: formula on group
     Posted: 29 Sep 2010 at 10:23am
This should be an easy thing to figure out but I'm having trouble.
 
I have a report that lists all cashiers in one column, transaction counts in the next, and total amount tendered in the last.
I need a new column to divide the total amount tendered by the transaction count.
 
The formula I have is:
(Sum ({Transaction.Total}))/(DistinctCount ({Transaction.TransactionNumber}))
 
which works fine for the grand total but I can't figure out how to have it per cashier. Thank you for your help!
IP IP Logged
rvink
Groupie
Groupie
Avatar

Joined: 04 Feb 2008
Location: New Zealand
Online Status: Offline
Posts: 55
Quote rvink Replybullet Posted: 29 Sep 2010 at 10:33am
Agreggate functions like Sum and DistinctCount will work on the entire dataset, unless you tell it to count only a group. The group field is a second optional parameter to these functions:

Sum ({Transaction.Total}, {table.groupfield}) / (DistinctCount ({Transaction.TransactionNumber}, {table.groupfield}))
IP IP Logged
mostrador
Newbie
Newbie


Joined: 20 Jul 2010
Online Status: Offline
Posts: 8
Quote mostrador Replybullet Posted: 29 Sep 2010 at 10:38am
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