Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Showing Month to Date and Year to Date on same lin Post Reply Post New Topic
Author Message
BorisH
Newbie
Newbie


Joined: 16 Aug 2010
Location: Canada
Online Status: Offline
Posts: 3
Quote BorisH Replybullet Topic: Showing Month to Date and Year to Date on same lin
     Posted: 16 Aug 2010 at 3:23am
Hello all,
 
I have a simple sales report setup that shows sales year-to-date for a range of products.
 
The selection formula lists invoice-date = yeartodate
 
I then display a total of all sales for each product. No problem.
 
Can I now show sales Month to date right beside the year to date number? I tried to write a formula that sums the same number as year to date, but can't see how to apply the 'month-to-date' condition and get a good number.
 
Any help appreciated!
 
Boris
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 16 Aug 2010 at 3:31am
if you have a group based on the month, then you can use that to sum the numbers.  You don't need to display the grouping, but it would need to exist.
 
Or you can write a formula like:
if month({table.datefield}) = month(now) and year({table.datefield}) = year(now) then
  do something.
 
not sure how you want to see/display the value.  if it is to be displayed in a group footer, you could add to a running variable using either running totals or shared variables (i like shared variables, DBlank is running totals)
 
HTH
IP IP Logged
BorisH
Newbie
Newbie


Joined: 16 Aug 2010
Location: Canada
Online Status: Offline
Posts: 3
Quote BorisH Replybullet Posted: 16 Aug 2010 at 3:50am
Getting closer...thanks for the suggestion.
I added a grouping for months, now I get the data this way...note I am reporting on the current calendar year
 
 
product1        sales YTD
                                              sales Jan
                                              sales Feb
                                              sales Mar ... and so on until Aug MTD
 
How I'd like to see it...
 
product1        sales YTD       sales this MTD (only current MTD)
 
Is this possible?
 
Boris
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 16 Aug 2010 at 10:43am
you could suppress the month band if it is not the current month.
 
something like:
in month section (section expert)
month(now) <> month({table.dateField})
 
this should hide all except the current month.
 
HTH
IP IP Logged
BorisH
Newbie
Newbie


Joined: 16 Aug 2010
Location: Canada
Online Status: Offline
Posts: 3
Quote BorisH Replybullet Posted: 17 Aug 2010 at 3:03am
Thanks once again...that worked.
 
Now some more follow-up...
 
Can these different summaries be shown on the same row?
 
Currently they appear like this...
 
sum1
         sum2
                  sum3
 
But it would be preferable to get this...
 
sum1   sum2   sum3
 
Thanks for the great info!
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 17 Aug 2010 at 3:28am
if they are purely aggregates (SUM(), COUNT(), etc) then yes.  You can create a formula or probably just move the field onto the same line.  If you don't get the total that you are expecting you can use the formula is this will 'fix' the group that you are using for the aggregate.
 
This mostly applies if you are displaying the values in the header.  If you display them all in the footer, you can always create a formula to use a shared variable to explicitly decide which values to use.
 
HTH
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