Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Report Design
Message Icon Topic: Date Range Post Reply Post New Topic
Author Message
martbar
Newbie
Newbie


Joined: 04 Apr 2012
Location: United States
Online Status: Offline
Posts: 15
Quote martbar Replybullet Topic: Date Range
    Posted: 06 Oct 2012 at 5:03am

Hey all,

I am no expert on crystal or programming so I hope this post isn't too simple-minded...looking to insert a section into my report that will change the master date range to a range 30 days previous and will run through all the formulas.
 
I've set up a parameter field called "Date Range", which allows the user to enter in a date range for the data to be run. So in select expert I have
{Match.Date} = {?Date Range}
 
I'm inserting a formula into the report to be based off a date range that is 30 days prior to what the user enters so I can calculate a percentage for that previous 30 days to compare with the percentage of the 30 day period the user entered.
 
So I am thinking something like
{Match.Date} = (minimum({?Date Range})-30) to (maximum({?Date Range})-30)
 
however how can I get this to run through all the formulas and logic to get a percentage for this altered date range.
 
the ultimate formula that calculates % for the user based on parameter field "Date Range" is
 
IF
isnull({@Locations})=true
THEN
0
ELSE
((distinctcount({@Locations},{@Origin})-{@late})/distinctcount({@Locations},{@Origin}))*100
I need to get this to also run for
{Match.Date} = (minimum({?Date Range})-30) to (maximum({?Date Range})-30)
 
how can I do this?
 
 
IP IP Logged
Sastry
Moderator
Moderator
Avatar

Joined: 16 Jul 2012
Online Status: Offline
Posts: 537
Quote Sastry Replybullet Posted: 07 Oct 2012 at 6:49pm
Hi
 
It is simple, in your if condition you need to validate whether the date range is user selection or previous month.
 
 
IF
isnull({@Locations})=true
THEN
0
ELSE
If {Match.Date} = (minimum({?Date Range})-30) to (maximum({?Date Range})-30) then
((distinctcount({@Locations},{@Origin})-{@late})/distinctcount({@Locations},{@Origin}))*100
I need to get this to also run for
{Match.Date} = (minimum({?Date Range})-30) to (maximum({?Date Range})-30)
else
0
 
Thanks,
Sastry
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.