Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Formula help Post Reply Post New Topic
Author Message
dutyfree
Newbie
Newbie


Joined: 21 Jul 2008
Online Status: Offline
Posts: 24
Quote dutyfree Replybullet Topic: Formula help
     Posted: 24 Jul 2008 at 10:05am
I have field which is being pulled directly from the stored proc in my crystal report. I then sum this field based on group created using the Running Total Fields in the field explorer. I need to get the percent value of this field of the total sum but i keep on getting the error "The field cannot be used as a group condition field".

for example :

Group by Department          No of sales            %

A                                                80                     trying to get this value
B                                              100

total                                         180 (running total)       

my formula used is  PercentOfSum(no of sales, running total) but i keep on getting the error.

Please assist.


Edited by dutyfree - 24 Jul 2008 at 10:35am
IP IP Logged
rahulwalawalkar
Senior Member
Senior Member
Avatar

Joined: 08 Jun 2007
Location: United Kingdom
Online Status: Offline
Posts: 731
Quote rahulwalawalkar Replybullet Posted: 24 Jul 2008 at 11:33am
Hi,
 
create a formula frm_%
 
Use the code below
{#RTotal0}%sum({noofsales},{department})
 
cheers
Rahul
IP IP Logged
dutyfree
Newbie
Newbie


Joined: 21 Jul 2008
Online Status: Offline
Posts: 24
Quote dutyfree Replybullet Posted: 25 Jul 2008 at 2:10am
Hi Rahul

Thanks for the quick reply. I tried that and the formula did not throw any errors however i now realised that the Departments A, B , C are actually Group Name and hence the result is incorrect.

The department has been group and the total sales is sum of the sales field from store proc.




IP IP Logged
rahulwalawalkar
Senior Member
Senior Member
Avatar

Joined: 08 Jun 2007
Location: United Kingdom
Online Status: Offline
Posts: 731
Quote rahulwalawalkar Replybullet Posted: 25 Jul 2008 at 2:54am

Hi,

Can you please clarify ,what output you expecting also paste some more sample data.

Cheers

Rahul

 



Edited by rahulwalawalkar - 25 Jul 2008 at 2:54am
IP IP Logged
rahulwalawalkar
Senior Member
Senior Member
Avatar

Joined: 08 Jun 2007
Location: United Kingdom
Online Status: Offline
Posts: 731
Quote rahulwalawalkar Replybullet Posted: 25 Jul 2008 at 3:13am

Hi

use below

{#RTotal0}%SUM({table.fieldname}) this is your sales amount field

hope this helps
cheers
Rahul
IP IP Logged
dutyfree
Newbie
Newbie


Joined: 21 Jul 2008
Online Status: Offline
Posts: 24
Quote dutyfree Replybullet Posted: 25 Jul 2008 at 3:31am
Sorry for not making it clear. I have attached an actual example used in the report.

Broker                                   Shares executed       % of total                           

(group1 # Name)  BrokerA         64600                   expect   34.74        
(group1 # Name)  BrokerB         15332                   expect   8.26  e.t.c...
(group1 # Name)  BrokerC         20000
(group1 # Name)  BrokerD         86000                 

Total                                        185932                    100

The total is made using the running total on field explorer.

When i used you formula   185932 % sum(64600(column from stored proc), BrokerA)   i get value of percent as 0.16 and value for BrokerB as 0.71....

Hope this makes sense.

  
IP IP Logged
rahulwalawalkar
Senior Member
Senior Member
Avatar

Joined: 08 Jun 2007
Location: United Kingdom
Online Status: Offline
Posts: 731
Quote rahulwalawalkar Replybullet Posted: 25 Jul 2008 at 5:13am
Hi,
 
create formula
 
PercentOfSum ({Table.Sharesexecuted}, {Table.Dept}) place that in details section or group header
 
which gave me the correct output.
 
then i inserted  summary as
 
Insert summary ,
select shares executed  calculate summary as SUM
Location as Group which is dept then select  Show as Percentage of  grand total sum of sale it will create % for all groups then just cop paste that in report footer
 
cheers
Rahul
 
IP IP Logged
dutyfree
Newbie
Newbie


Joined: 21 Jul 2008
Online Status: Offline
Posts: 24
Quote dutyfree Replybullet Posted: 25 Jul 2008 at 8:25am
Thanks Rahul for your assistance and giving me some indications.

I realised that my total was calculating based on group as well when it should be sum of ShareExecuted. The share executed should have been sum(share executed, dept) and it worked when i used percentofsum(shareexecuted, dept)

Thumbs%20Up


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