Print Page | Close Window

Date Range

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Report Design
Forum Discription: The best way to design a report and problems you have encountered
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=17701
Printed Date: 04 May 2024 at 5:46am


Topic: Date Range
Posted By: martbar
Subject: Date Range
Date 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( mailto:%7b@Locations%7d%29=true - {@Locations})=true
THEN
0
ELSE
((distinctcount({@Locations},{@Origin})-{@late})/distinctcount( mailto:%7b@Locations%7d,%7b@Origin%7d%29%29*100 - {@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?
 
 



Replies:
Posted By: Sastry
Date 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( mailto:%7b@Locations%7d%29=true - {@Locations})=true
THEN
0
ELSE
If {Match.Date} = (minimum({?Date Range})-30) to (maximum({?Date Range})-30) then
((distinctcount({@Locations},{@Origin})-{@late})/distinctcount( mailto:%7b@Locations%7d,%7b@Origin%7d%29%29*100 - {@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



Print Page | Close Window