web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics SL (Archived)

Crystal Reporting YTD Formula

(0) ShareShare
ReportReport
Posted on by 1,348

Hi

To all the crystal report experts on this forum, I hope that I can get some assistance in a formula that I am trying to create but the results that I am looking for escapes me.

I created a report that shows AP monthly transactions as a total, YTD and Prior YTD values as summary totals based upon the month the report was printed on a specific account.

I am able to get the monthly values but the YTD and the Prior YTD values is giving me values 12 months prior from the month the report is printing.  However, I want the values from the beginning of the fiscal year to the month the report was printed.

For example, if the fiscal year is from October - September 2016, and I print the report for the 07 period, which is May month, the monthly values for May is accurate, but I want the YTD values to give me from October 2016 to May 2016 or from the 01 period to 08 period.  So any month the report prints, the YTD should always starts from the beginning of the fiscal year.

Right now it is giving me 12 periods prior from  the time the report was printed because 12 is hardcoded in the formula. This is the formula I am presently using:

StringVar BegPer;
StringVar EndPer;


If Right(RIPARAM("BegPerNbr"),2) = '12' then
    BegPer :=  ToText(ToNumber(Left(RIPARAM("BEGPERNBR"),4))-0,"####") + '01'
Else
    BegPer :=  ToText(ToNumber(Left(RIPARAM("BEGPERNBR"),4))-1,"####")+ ToText(ToNumber(Right(RIPARAM("BegPerNbr"),2))+1,'00') ;
  

EndPer := RIPARAM("BegPerNbr");


If {APTran.PerPost} <= EndPer and {APTran.PerPost} >= BegPer  and {APDoc.DocType} = 'VO' then
    {APTran.TranAmt}

I am also trying to use the dateserial and the in date formulae but so far I am not getting it to show what I am looking for.  Could someone point me in the right direction.  Any assistance will be greatly appreciated.

Thanks in advance

*This post is locked for comments

I have the same question (0)

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics SL (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans