Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Report Design
Message Icon Topic: Difference from Month to Previous Month Post Reply Post New Topic
Author Message
Basuum
Newbie
Newbie


Joined: 03 Apr 2014
Online Status: Offline
Posts: 2
Quote Basuum Replybullet Topic: Difference from Month to Previous Month
    Posted: 04 Apr 2014 at 5:49am
I am a novice using Crystal. I would appreciate help with what I believe requires a formula.
I need to display the difference between readings from month to month. I need to subtract the last month from the previous month and have been unable to figure out how to do it.

field    date     number
equip    1/1/14    136
equip    2/1/14    139 (display '3')
equip    3/1/14    140 (display '1')
                      Display total '4'
Thanks for any help.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 04 Apr 2014 at 10:05am
table.number - previous(table.number)
IP IP Logged
Basuum
Newbie
Newbie


Joined: 03 Apr 2014
Online Status: Offline
Posts: 2
Quote Basuum Replybullet Posted: 07 Apr 2014 at 5:18am
Thank you!
How 'bout if I'm grouping on the equip field? I need the total for each month and grand total for each piece of equipment.

field    date     number
equip1    1/1/14   136
equip1   2/1/14    139 (display '3')
equip1    3/1/14   140 (display '1')
                      Display total '4'

field    date     number
equip2    1/1/14    95
equip2    2/1/14    96.60 (display '1.60')
equip2    3/1/14    97.20 (display '.60')
                      Display total '2.20'
IP IP Logged
otto
Groupie
Groupie


Joined: 17 Mar 2014
Online Status: Offline
Posts: 53
Quote otto Replybullet Posted: 08 Apr 2014 at 11:15am
create a shared variable that storage this result table.number - previous(table.number) per detail
shared numbervar total := total + abs(table.number - previous(table.number)) then show that variable in your group footer and also initialize it in 0 in your group header, so every time the group changes it will clean it.
IP IP Logged
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.031 seconds.