Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Comparions Post Reply Post New Topic
Author Message
HEMREDDY
Newbie
Newbie


Joined: 31 Jul 2013
Online Status: Offline
Posts: 38
Quote HEMREDDY Replybullet Topic: Comparions
     Posted: 25 Mar 2014 at 6:01am
Hi,
 
I have the folloiwng data.
 
Invoice Date   Customer Name Sales.
 
 
I want to compare sales by customer for this week with sales by customer for the same week of last year.
 
The reports hould look like this.
 
Customer Name         Current Period            Same period
                                       sales                previous year sales
                                Mar 16 2013 to        March 16 2012 to
                                Mar 22 2013            March 22 2013
Reddy                            10,556.25               9,256.35
Amol                                6,256.00               9,356.00
 
Is this possible in one report and using just one parameter date range value of March 16 2013 to March 22 2013.
 
Could someone help me with this.
 
Hem Reddy
IP IP Logged
lolly54
Groupie
Groupie
Avatar

Joined: 25 Sep 2011
Online Status: Offline
Posts: 58
Quote lolly54 Replybullet Posted: 25 Mar 2014 at 11:17pm
You will need two date parameters only:
{@Report From} and {@Report To}.

By using these two parameters, you can then create another two formulas  to get the last year period.

{@Same Period Last Yr From}
DateAdd("yyyy", -1, {@Report From})

{@Same Period Last Yr To}
DateAdd("yyyy", -1, {@Report To})

Then, to get the last year sales, another formula
{@Sales last year}
If sales.date in {@Same Period Last Yr From} to {@Same Period Last Yr To}
then sales.sales
else 0


To get current year sales
{@Sales this year}
If sales.date in {@Report From} to {@Report To}
Then sales.sales
else 0


Hope this helps!


Edited by lolly54 - 25 Mar 2014 at 11:19pm
IP IP Logged
HEMREDDY
Newbie
Newbie


Joined: 31 Jul 2013
Online Status: Offline
Posts: 38
Quote HEMREDDY Replybullet Posted: 26 Mar 2014 at 1:55am
Thanks. I figured that out later yesterday.
 
hem Reddy
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