x
• Status: Solved
• Priority: Medium
• Security: Public
• Views: 2416

# Crystal Reports SubTotals , YTD Sales, MTD Sale and Week Sales on the same report

Dear all,

I'm curious about how to achieve what I thought was a simple report showing Sales Year to Date, Month to Date and Week to Date.
All displayed on one Group Footer.

The best way to explain what I'm trying to achieve is attached below in the image.

I've been working with the Crystal Formula. e.g.
`````` Sum({Sales in GBP},{@Sales Month})
``````

I guess need to create the following groups:

Group 1 =  Customer
Group 2 =  Sales Year
Group 3 =  Sales Month

Then using the today() formula I can work out how make a record selection for Year(SalesDate) = Year(Today())
Year to day Sales Total is quite easy.

But then how do I put on the same group footer the Month to Date total?
Then finally the Week to Date total on the same group footer?

I need some pointer in case I'm going about his in completely the wrong way.
Should I be using Running totals?

Thanks
mchallinor
Report-Layout.png
0
Mchallinor
1 Solution

Commented:
Crystal has prebuilt date range functions

YTD

If {SalesDate} IN YearToDate then
{SalesAmount}
Else
0

MTD
If {SalesDate} IN MonthToDate then
{SalesAmount}
Else
0

WTD
If {SalesDate} IN WeekToDateFromSun then
{SalesAmount}
Else
0

You can also use
LastFullWeek
Last7Days

The above formulas can be used in summary functions to get the total

mlmcc
0

Author Commented:
Wow,  How have I not used this formula before!   Thank you so much.
I thought it would be easy, but that is crazy simple.

Cheers
mchallinor
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.