Print Page | Close Window

MTD and YTD

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Report Design
Forum Discription: The best way to design a report and problems you have encountered
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=21375
Printed Date: 03 May 2024 at 4:38am


Topic: MTD and YTD
Posted By: CrystalGirl
Subject: MTD and YTD
Date Posted: 13 Mar 2015 at 2:22pm
Hi all,

Anyone can help me to do a formula to calculate the YTD?

I am creating a yearly revenue report. There are three columns from one table in the same datasource. Let's called it "Accounting". The three columns are: Months, Debit and Credit.

Here are "Accounting" table data:

Month      Debit     Credit
01/2015    500        400
02/2015    600        300
03/2015    400        200
04/2015    500        200
05/2015    400        200
06/2015    600        100
07/2015    400        300
08/2015    500        200
09/2015    600        400
10/2015    500        100
11/2015    600        500
12/2015    400        200

The Revenue is: Debit - Credit, so here are the Revenue on every month.(MTD)
01/2015: 100
02/2015: 300
03/2015: 200
04/2015: 300
05/2015: 200
06/2015: 500
07/2015: 100
08/2015: 300
09/2015: 200
10/2015: 400
11/2015: 100
12/2015: 200

Here the YTD report I want to do:
Month       MTD    YTD
01/2015:    100    100
02/2015:    300    400
03/2015:    200    600
04/2015:    300    900
05/2015:    200    1100
06/2015:    500    1600
07/2015:    100    1700
08/2015:    300    2000
09/2015:    200    2200
10/2015:    400    2600
11/2015:    100    2700
12/2015:    200    2900

Anyone know how to do the formula?

Thank you all



Replies:
Posted By: DBlank
Date Posted: 16 Mar 2015 at 4:09am
one formula will be your MTD
table.debit-table.credit
the YTD is a Running Total (or shared variable formulas) using the MTD formula
 
RT
Name = YTD
field to mailto:summarize=@MTD - summarize=@MTD
type = sum
evaluate=for each record
reset=never
place on details to see rolling value and also in Report footer to see final outcome. will not work in a header.


Posted By: CrystalGirl
Date Posted: 16 Mar 2015 at 4:00pm
Hello DBlank,

Thank you for the response and your time. The problem is, I have to run the report every month. So for example, if I run January report, I have YTD for January, but if I run February report, I only get the February running YTD. So, how do I include the YTD for January on the February report?

So basically when I run the report, I only run for one month. I want to be able to make my YTD dynamic depending what month I choose. If I choose, March, then I should have YTD from January, February and March added but right know, my YTD amount is based on the period I choose. If I choose March, my current YTD is the YTD amount of March only.

I really appreciated your time and help DBlank. Do you have any idea how to solve this?


Posted By: CrystalGirl
Date Posted: 16 Mar 2015 at 4:04pm
updated. See above response.


Posted By: DBlank
Date Posted: 17 Mar 2015 at 4:54am
you have to "run it" for the entire year of data.
If you want your MTD to only show one month then you handle that in conditional display of the overall record set.



Print Page | Close Window