Solved

Running Total for Trailing Twelve Months

Posted on 2006-06-13
9
768 Views
Last Modified: 2007-10-19
How do I set up a running total field so that it resets itself after every twelve months, assuming this is the right way to accomplish what I am trying to do. for example, for each month of investments, sum up that month and the last twelve months of investments on that month's row.

I have several years worth of financial trade data and so far I have been able to group the trades by month.  Now I want to show a field next to it that totals the amount of trades made for the last twelve months respectively.  May be running total field is not the way to do this?

Example below of what I am trying to accomplish:

Month      Amount       Running Total Last Twelve Months
Mar 05       20            
Apr 05        10
May 05       10
Jun 05        10
Jul 05         20
Aug 05       10
Sep 05       30
Oct 05        40
Nov 05       10
Dec 05       20
Jan 06        10
Feb 06        50
Mar 06       10            250 (this is the sum of Mar'05 - Mar'06)
Apr 06        30           260  (this is the sum of Apr'05 - Apr'06)
May 06       40           290  (this is the sum of May'05 - May'06)
Jun 06        50           330  (this is the sum of Jun'05 - Jun'06)
etc....

Thanks for your help.  I hope my question is clear.
0
Comment
Question by:IO_Dork
  • 4
  • 4
9 Comments
 
LVL 9

Expert Comment

by:Outin
ID: 16900653
Something like this could do the trick:

  //@TrailingSum
  numbervar array PreviousMonths[12];
  numbervar i;
  for i := 1 to 11 do
  (
   PreviousMonths[i] := PreviousMonths[i+1];
  );
  PreviousMonths[12] := {LEDGER_ITEM_CU_QRY\.INV_DOM_AMOUNT};
  sum(PreviousMonths);

--
Outin
0
 

Author Comment

by:IO_Dork
ID: 17081872
How do I incorporate this formula into my running total formula? or do I just scrape the running formula and create a new Formula Field based on your formula above?
0
 
LVL 9

Expert Comment

by:Outin
ID: 17081893
This would be a new formula indeed...

--
Outin
0
 

Author Comment

by:IO_Dork
ID: 17081920
ok, thanks.  I'll give it a try.
0
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 

Author Comment

by:IO_Dork
ID: 17105601
I am not able to get this formula to work.  Also, I don't see anywhere in the formula that looks at the date field and the amount field so that it can sum up the investment amounts for the trailing twelve month period.  The two fields in question are {trade.settlement_date} and {trade.investment_amount}.

I guess I just don't understand how this formula is supposed to be incorporated in to the report other than adding it as a new formula field, but when I try to do that crystal reports gives me an error when trying to save the formula and it tells me that the field name {LEDGER_ITEM_CU_QRY\.INV_DOM_AMOUNT} is not known.
0
 
LVL 9

Accepted Solution

by:
Outin earned 500 total points
ID: 17108956
Sorry, my bad.
"{LEDGER_ITEM_CU_QRY\.INV_DOM_AMOUNT}" is a field I used when testing this solution.
You should replace it with the field you want to calculate the trailing sum for.

Besides that, I assumed you had 1 record for every month, yet now I notice you have more records for each month.
So proceed like this:
- Group your data by month
- Create the formula mentioned previously, place it in the group footer.
   Replace the '{LEDGER_ITEM_CU_QRY\.INV_DOM_AMOUNT}'-part with

    Sum({trade.investment_amount}, {trade.settlement_date}, "monthly")

--
Outin
0
 

Author Comment

by:IO_Dork
ID: 17110213
FYI - I acually have a record for every trade done, so that means a few thousand trades a month.  So what I did was tell cyrstal reports to group all trades by month and had it sum up the dollar amounts of all trades per month. that is what I am currently working with now and that is the state of the report that I am now trying to add an additional column to sum the trailing twelve months in dollar amounts invested.
0
 
LVL 9

Expert Comment

by:Outin
ID: 17239502
Then the solution I proposed in my previous post should work for you....

--
Outin
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now