Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Financial Sales Report w/ LY included Post Reply Post New Topic
Author Message
saintspidey
Newbie
Newbie


Joined: 05 May 2014
Location: United States
Online Status: Offline
Posts: 1
Quote saintspidey Replybullet Topic: Financial Sales Report w/ LY included
     Posted: 05 May 2014 at 7:33am
How can I create a report that shows this month's sales total by customer, and next to it, last year's sales for the same month?

Example;
May 2014 Sales by customer, May 2013 Sales by customer.
would like to do this in a columnar fashion.

Thanks
saintspidey
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 05 May 2014 at 7:54am
use datpart to extract the month and then again to exract the year and group on those in a crosstab (first the month then the year)
from that you can sum the sales field
 
datepart('m',salesdate)
datepart('yyyy',salesdate)
 
IP IP Logged
kostya1122
Senior Member
Senior Member
Avatar

Joined: 13 Jun 2011
Online Status: Offline
Posts: 475
Quote kostya1122 Replybullet Posted: 05 May 2014 at 8:00am
you could try
formula1 this month's sales
if year(data.datefield) = year(currentdate) and
month(data.datefield) = month(currentdate) then data.amount else 0

formula2 last year sales
if year(data.datefield) = year(currentdate)-1  and
month(data.datefield) = month(currentdate) then data.amount else 0

group on customer
create 2 summaries
sum(formula1)
sum(formula2)
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