cancel
Showing results for 
Search instead for 
Did you mean: 

How to get subtracts data from previous field in crystal report formula

0 Kudos

Hi,

How i can write formula to get the difference here.

I need to subtract meter reading value from its previous data , In my below example the difference field will be like this , How can i achieve this... Please help

0

1522

42

3090 .....

Accepted Solutions (1)

Accepted Solutions (1)

abhilash_kumar
Active Contributor
0 Kudos

Hi Salam,

I assume you have a group on the Equipment ID field. Try these steps:

1. Create a formula with this code and place on the Details under the Difference column:

shared numbervar x := x + 1;
If x = 1 Then 0
else {Meter Reading} - previous({Meter Reading}

2. Create a reset formula with this code and place this on the Group Footer:

shared numbervar x := 0;
'';

-Abhilash

Answers (2)

Answers (2)

jomyts
Discoverer
0 Kudos

Hi, please help for the below query.

there are different items, i would like to subtract value from the same items and show in the "In Stock".

JWiseman
Active Contributor
0 Kudos

Hi IT Support, please Ask a new Question on the Crystal forum as this is a new question. In your new question it would be helpful to post a picture of your report in Design mode as well so that we can see how it is structured.

thanks, -jamie

former_member198519
Active Contributor
0 Kudos

try:

If OnFirstRecord then 0 else {Meter Reading} - Previous ({Meter Reading})