Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Cross Tab Design Post Reply Post New Topic
Author Message
kpsmithuk
Newbie
Newbie
Avatar

Joined: 03 Feb 2011
Location: United Kingdom
Online Status: Offline
Posts: 15
Quote kpsmithuk Replybullet Topic: Cross Tab Design
     Posted: 18 Feb 2011 at 2:11am
I want to create a cross tab report that will show the cumulative daily sales over a user defined period of time and the same data for 1 year before, then chart both against the date for comparrison reasons.
 
I know how to do it for a user defined period but am having problems setting the report to automatically pick up the data and add it in for the previous year or the best way to describe it would be 365 days older.
 
I know I would need 2 formula fields
 
{Start Date 2} = {Start Date} - 365
{Finish Date 2} = {Finish Date} - 365
 
but how do I tell the report that to add another row showing the sum of sales prices for the selected customer (already set by user at start of report) and between Start date 2 and finish date 2
 
for the report that only shows the user requested period I have used the record selection formula  
 
(if {?Customer} = "*" then
    True
Else
{salesorders.scustomer} = {?Customer};) and
{salesorders.sdate} >= {?S Date} and {salesorders.sdate} <= {?F Date}
 
My Current cross tab is set up as follows
 
Columns:
salesorders.sdate (sale date)
 
Sumerised fields:
Sum of salesorders.sprice (sum of sales order lines for each date)
#TTurn (running total of salesorders.sprice = running turnover total for each date)
 
 
 
IP IP Logged
kpsmithuk
Newbie
Newbie
Avatar

Joined: 03 Feb 2011
Location: United Kingdom
Online Status: Offline
Posts: 15
Quote kpsmithuk Replybullet Posted: 28 Feb 2011 at 5:23am
Ok so I've changed my report a little
 
I now have a cross tab where my columns are the salesorders.sdate (grouped by year) and the rows are grouped by month, this is fine but show the sales data for every month over every year, however it has a row for Jan-December for each year not just Jan to December so my data is staggered horribbly I've suppressed zero values,
 
All I want it to do is give me cumulative turnover month by month for each year with all the data side by side not staggered
 
any ideas?
 
The chart I will work on from there.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 28 Feb 2011 at 5:30am
you mean that you grouped your row on the sdate field and set it for each month?
instead create a formula field to extract the month value from the sdate and group on that. you will need to add the numbers to the name to keep it in order of Jan-Dec.
totext(month({salesorders.sdate}),'00') + '-' + monthname(month({salesorders.sdate}))
 
or to use an abbreviated month name ...
totext(month({salesorders.sdate}),'00') + '-' + monthname(month({salesorders.sdate}),true)
 


Edited by DBlank - 28 Feb 2011 at 5:31am
IP IP Logged
kpsmithuk
Newbie
Newbie
Avatar

Joined: 03 Feb 2011
Location: United Kingdom
Online Status: Offline
Posts: 15
Quote kpsmithuk Replybullet Posted: 28 Feb 2011 at 5:36am
yes sorry that was what I meant and the same for the column but set to each year.
  
thanks for the help works perfectly my report is now coming together niceley. Now to disasemble  the formula so i understand how it works!
 
 


Edited by kpsmithuk - 28 Feb 2011 at 6:08am
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 28 Feb 2011 at 7:07am
The formula is set to extract the month number from the date field (purple) and then convert the number to text (red) so it can be combine with the name which is text and format the text with a lead zero to make sure it stays in order of 01-12 (blue)
 
totext(month({salesorders.sdate}),'00')
 
then adds a - to this number (red)
 
+ '-' +
 
then extracts the monthnumber from the same date field again (purple) and then converts that number to the monthname as text (red) and uses the short month name (blue)
monthname(month({salesorders.sdate}),true)


Edited by DBlank - 28 Feb 2011 at 7:09am
IP IP Logged
kpsmithuk
Newbie
Newbie
Avatar

Joined: 03 Feb 2011
Location: United Kingdom
Online Status: Offline
Posts: 15
Quote kpsmithuk Replybullet Posted: 28 Feb 2011 at 9:49pm
thanks dblank, makes perfect sense now, and to think I used to program in c++ and visual basic! Oh how lazy I have got with shiny wizzards and basic formulae!
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