Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics SL forum
Unanswered

Crystal Reporting YTD Formula

Posted on by 1,270

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

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

Anton Venter – Community Spotlight

Kudos to our October Community Star of the month!

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,558 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,647 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans