Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: YTD formula Post Reply Post New Topic
Author Message
CrystalGirl
Newbie
Newbie


Joined: 22 Feb 2015
Online Status: Offline
Posts: 36
Quote CrystalGirl Replybullet Topic: YTD formula
    Posted: 21 Mar 2015 at 8:28am
Hi all,

I am still working on my YTD calculation so I am wondering if anyone can help me to solve this?

Here is the actual report that I am working on.

January Report:
Item Description        MTD   YTD
Travelling Cost        $6800 $6800
Medical cost           $ 400 $ 400
Car Maintenance cost   $ 750 $ 750

February Report:
Item Description        MTD   YTD
Travelling Cost        $1000 $1000
Medical cost           $ 500 $ 500
Car Maintenance cost   $ 200 $ 200

March Report:
Item Description        MTD   YTD
Travelling Cost        $ 500 $ 500
Medical cost           $ 200 $ 200
Car Maintenance cost   $ 100 $ 100

The formula for my MTD is: round({Debit} - {Credit})

Here are the data/fields I am using:
Item Description is from column: {ItemDescription}
Debit : {Debit}
Credit: {Credit}
FiscalYear: {FiscalYear}
FiscalPeriod: {FiscalPeriod}

The parameters I have on the report:
{?FiscalYear} in {FiscalYear} (value:01,02,03,04,05,06,07,08,09,10,11,12)
{? FiscalPEriod} in {FiscalYear} (value: 2015)

So, what I am trying to achieve is to have the right amount of YTD on February, March and so on report...currently my YTD is the MTD amount on each month.

So the report should looks like this:
January Report:
Item Description        MTD   YTD
Travelling Cost        $6800 $6800
Medical cost           $ 400 $ 400
Car Maintenance cost   $ 750 $ 750

February Report:
Item Description        MTD   YTD
Travelling Cost        $1000 $7800
Medical cost           $ 500 $ 900
Car Maintenance cost   $ 200 $ 950

March Report:
Item Description        MTD   YTD
Travelling Cost        $ 500 $8300
Medical cost           $ 200 $1100
Car Maintenance cost   $ 100 $1050

thought about create a YTD formula and assigned my YTD for a specific MTD for is not working...for example:
MTD01: round(({Debit} in ({FiscalPeriod}="01") - ({Credit}) in {FiscalPeriod} = "01"))
MTD02: round(({Debit} in ({FiscalPeriod}="02") - ({Credit}) in {FiscalPeriod} = "02"))
MTD03 for march and so on until MTD12 for December


YTD=
if {FiscalPeriod} = 01 then MTD01
else
if {FiscalPeriod} = 02 then MTD01 + MTD02
else
if {FiscalPeriod} = 03 then MTD01 + MTD02 + MTD03
and so on until {FiscalPeriod} = 12

Anyone can help?

IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 23 Mar 2015 at 7:27am
I think you are complicating this too much and you are trying to get sub -type summaries inside each month/year which becomes more difficult as you would need unique formulas per type.
 
Are you married to this outcome design or could you use grouping at the Item instead like this?
Travelling Cost
Month               MTD       YTD 
Jan                  $6800    $6800 
Feb                $ 1000     $7800 
Mar                 $ 500      $8300
 
If you absolutely need it the way you orginally posted it are there only the 3 Item types (travel, medical, maintence) or are there more and can more be added?
IP IP Logged
Post Reply Post New Topic
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



This page was generated in 0.016 seconds.