Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Report Design
Message Icon Topic: Difference bewteen two values of same group Post Reply Post New Topic
Page  of 2 Next >>
Author Message
SachinPawar
Newbie
Newbie


Joined: 01 Sep 2012
Online Status: Offline
Posts: 12
Quote SachinPawar Replybullet Topic: Difference bewteen two values of same group
    Posted: 14 Oct 2012 at 11:35pm
Hi,
I have following table and I want tocalculate difference between two values but based on the group. I'm displaying the records as latest to oldest.

1    A     4
2    A     5     -1
3    A     2      3
4    B     6
5    B     3      3
6    C     10
7    C     11     -1
8    C     9      2
i.e calculate the difference between first and previous value till value in colB (A,B,C) is same.

Thanks
Sachin
IP IP Logged
SachinPawar
Newbie
Newbie


Joined: 01 Sep 2012
Online Status: Offline
Posts: 12
Quote SachinPawar Replybullet Posted: 14 Oct 2012 at 11:35pm
Please help me out its very urgent........
IP IP Logged
Sastry
Moderator
Moderator
Avatar

Joined: 16 Jul 2012
Online Status: Offline
Posts: 537
Quote Sastry Replybullet Posted: 15 Oct 2012 at 12:04am
HI
 
 
Think your numbers are in a value column then
 
Create the following formula and place in your detail
 
Previous({Value}) -  Value
Thanks,
Sastry
IP IP Logged
SachinPawar
Newbie
Newbie


Joined: 01 Sep 2012
Online Status: Offline
Posts: 12
Quote SachinPawar Replybullet Posted: 15 Oct 2012 at 12:10am
Thanks for your reply.....

That I hv tried but it is calculating the difference for each value......I want it to calculate it based on the group. It is also showing the difference between the last value of A (2) and first value of B(6), which it shows 4.
and it is not that i want.
IP IP Logged
Sastry
Moderator
Moderator
Avatar

Joined: 16 Jul 2012
Online Status: Offline
Posts: 537
Quote Sastry Replybullet Posted: 15 Oct 2012 at 12:17am
HI
 
In your example, in A group it is display two values for difference and C group it is displaying 2 difference values.. is that u want or you want to display difference for only last goup item ?
Thanks,
Sastry
IP IP Logged
SachinPawar
Newbie
Newbie


Joined: 01 Sep 2012
Online Status: Offline
Posts: 12
Quote SachinPawar Replybullet Posted: 15 Oct 2012 at 12:19am
I want to calculate the difference for each group seperately.
IP IP Logged
Sastry
Moderator
Moderator
Avatar

Joined: 16 Jul 2012
Online Status: Offline
Posts: 537
Quote Sastry Replybullet Posted: 15 Oct 2012 at 12:23am
Hay Sachin..
 
I got it.  Use the same formula whic I told you and also create following formula s :
 
@init
Whileprintingrecords;   //Place this formula in group header
Numbervar x:=0;
 
 
@Disp
Whileprintingrecords; //Place this formula in detail
Numbervar x;
x:=x+1;
 
Now right click on the formula (Previous(value) -Value) and go in format --common--Suppress then give the following condition
 
Whileprintingrecords;  
Numbervar x;
If X = 1 then true else flase
 
 
 
Thanks,
Sastry
IP IP Logged
SachinPawar
Newbie
Newbie


Joined: 01 Sep 2012
Online Status: Offline
Posts: 12
Quote SachinPawar Replybullet Posted: 15 Oct 2012 at 12:31am

Hi,

I'm new to Crystal...

@init - First formula field i need to create and place it in Group header section on the design view


@Disp - - Second formula field i need to create and place it in Detail section on the design view

Not too clear on the below-

Now right click on the formula (Previous(value) -Value) and go in format --common--Suppress then give the following condition

Whileprintingrecords;
Numbervar x;
If X = 1 then true else flase

- First formula field i need to create and place it in Group header section on the design view- First formula field i need to create and place it in Group header section on the design view- Second formula field i need to create and place it in Detail section on the design view- Second formula field i need to create and place it in Detail section on the design viewNot too clear on the below-Not too clear on the below-
IP IP Logged
Sastry
Moderator
Moderator
Avatar

Joined: 16 Jul 2012
Online Status: Offline
Posts: 537
Quote Sastry Replybullet Posted: 15 Oct 2012 at 12:54am
I mean..
 
You create one more formula
 
@val
Previous({Value}) - {Valu}  //place this formula in detail to get difference.
 
Now on this formula i.e. (@val) right click ond go in format field --Common--Suppress--Formula editor and give the below formula
 
Whileprintingrecords;
Numbervar x;
If X = 1 then true else flase
Thanks,
Sastry
IP IP Logged
SachinPawar
Newbie
Newbie


Joined: 01 Sep 2012
Online Status: Offline
Posts: 12
Quote SachinPawar Replybullet Posted: 15 Oct 2012 at 1:26am
Thanks for your reply Sir.....it worked.
Just bothering you a little more....

In the same report I have a number of records for each group which have their own IDs and DateTime associated with it....Now I want to have the latest 10 number of records of each group.

If this also works then one of my major report is over...

Thanks in advance.....

Sachin
IP IP Logged
Page  of 2 Next >>
Post Reply Post New Topic
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



This page was generated in 0.016 seconds.