Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Current Value less then previous Post Reply Post New Topic
Author Message
dfox
Newbie
Newbie
Avatar

Joined: 14 Dec 2011
Online Status: Offline
Posts: 1
Quote dfox Replybullet Topic: Current Value less then previous
     Posted: 06 May 2012 at 3:09pm
Hello,
 
i am trying to create a forumla which will work out if Total Km Travelled is greater then the previous value on the date before. I am grouping by Bike Rider ID.
 
e.g
Group: BIKE_RIDER_ID
date      km Travelled
1/5/12        20
4/5/12        30
3/6/12        17
4/6/12         5
6/6 /12       20
 
Basically i want the report to highlight the value in RED if tis less than the prvious.
 
I have tried a few things, for example
 
if (kmtravelled) <= previous(kmtravelled) then
crRed else
crBlack
 
the issue is, its not working it out by group, so the last value 6/6/12 , 20  sometimes highlights red as it then compared to the value from the next riders ID...
 
any advice?
 
should i be doing this in a cross tab?
 
 
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 07 May 2012 at 3:35am
probably you want to add the grouping condition to the mix. the 'Previous' function doesn't care about the group boundary.
 
you might want to try something like:
 
if previous({table.groupCondition}) = {table.groupCondition} and previous({table.kmTravelled}) > {table.kmTravelled} then crRed else crBlack
 
HTH
 
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