Show TOC

Syntax documentation*CALC_EACH_PERIOD Locate this document in the navigation structure

Allowed uses: By Commit/Global, MDX, SQL

The instruction CALC_EACH_PERIOD can be inserted within a commit section, to enforce an orderly calculation of the members of the time dimension. When this instruction is present, the system scans the source records one period at a time, in ascending order from the oldest to the youngest. The results generated by each time period are merged with the rest of the record set, before the next period is calculated.

With this technique we can more easily and efficiently handle the typical calculations of financial reporting applications, where the results of one period are the inputs for the calculation of the next period.

Example Example

//----------------------------------------------------

*CALC_EACH_PERIOD

*WHEN ACCOUNT

*IS OPEN_BALANCE, MOVEMENTS

*REC(ACCOUNT=CLOSING_BALANCE)

*REC(ACCOUNT=OPEN_BALANCE,TIME=NEXT)

*ENDWHEN

//----------------------------------------------------

End of the example.

The above sample rule performs a carry-forward of the closing balance of each period into the opening balance of next period.