Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Calling DBlank & other experts Post Reply Post New Topic
Author Message
Neales
Newbie
Newbie


Joined: 01 Feb 2012
Online Status: Offline
Posts: 13
Quote Neales Replybullet Topic: Calling DBlank & other experts
     Posted: 15 Mar 2013 at 8:07am
Hi I'm putting together a report and I'm struggling with a particular aspect of it.
 
Below is some sample data from my details section.
 
Account            Value 2010            Value 2011 Check Difference
1 12.00 13.00 0.00 1.00
1 0.00 13.00 0.00 13.00
1 0.00 13.00 0.00 13.00
1 0.00 13.00 0.00 13.00
1 0.00 13.00 0.00 13.00
2 0.00 13.00 0.00 13.00
2 0.00 13.00 0.00 13.00
 
I need to calculate the difference between the 2010 and 2011 values which is easy enough and as you can see it is currently doing that. 
 
The tricky part (for me) is when there isn't a value for 2010 within any of the data returned for a particular account as I need the difference formula to return 0.
 
So for the data above, where there are two rows for account 2 the value 2010 is 0 for all rows with that account and therefore the difference column needs to show 0 because of this.
 
If you look at the rows where the account equals 1 there is one row where the value 2010 equals 12 although the rest of the rows with this account equal 0. I need a method of recognising that there has been one row of data for this account that has a figure greater than 0 in and therefore the difference formula is value 2011 - value 2010.
 
Hope this explains what I'm trying to do.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 15 Mar 2013 at 8:50am
group on account #
sum 2010 at the grouplevel and hen use that result in a running total evaluation formula or a sahred variable formula
IP IP Logged
Sastry
Moderator
Moderator
Avatar

Joined: 16 Jul 2012
Online Status: Offline
Posts: 537
Quote Sastry Replybullet Posted: 18 Mar 2013 at 3:02am
Hi
 
--Insert a group on Account
 
--Insert a summary on Value2010
 
Now create a formula like :
 
If sum(Value2010,account) > 0 then
Value2011-Value2010
else
0
 
 
Thanks,
Sastry
IP IP Logged
Neales
Newbie
Newbie


Joined: 01 Feb 2012
Online Status: Offline
Posts: 13
Quote Neales Replybullet Posted: 18 Mar 2013 at 3:23am
Thank you for your help, I've managed to do it!
 
Is it possible to use a running total in a formula such as
 
Sum ({@value 2010})/{running total}
 


Edited by Neales - 18 Mar 2013 at 3:24am
IP IP Logged
Neales
Newbie
Newbie


Joined: 01 Feb 2012
Online Status: Offline
Posts: 13
Quote Neales Replybullet Posted: 18 Mar 2013 at 3:33am
I'm trying to get the total revenue churn as a percentage of the total revenue for 2010.
 
The total revenue for 2010 is shown in the below image as 7,109,564 and the total revenue churn is -218,083 (this would need to be turned to a positive figure first)
 
 
The total revenue churn field is a running total as shown below
 
IP IP Logged
Neales
Newbie
Newbie


Joined: 01 Feb 2012
Online Status: Offline
Posts: 13
Quote Neales Replybullet Posted: 18 Mar 2013 at 3:40am
Answered my own question but just in case anyone has a similar question
 
Yes you can use a running total in a formula, for this I did
 
 
{#Total 10/11 Churn}/sum({@2010})
 
Thanks for your help guys - top class as always!


Edited by Neales - 18 Mar 2013 at 3:40am
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