Creating a Rule for Opening Balances
This example demonstrates one (of many) methods for using an opening balance rule to roll forward balances between financial years using some of the calendar capabilities detailed in previous posts.
In this example the Next and Prev attributes against the Year dimension are being used to Populate an element in a fictitious Month dimension called Opening Balance, though note the use of conditional logic to limit this to balance sheet accounts (both in the rule and feeder).
# Assumes Opening Balance element in month and rolls forward values from prior year. Also assumes attributes set against year dimension. # Calculate the opening balance ['Actual', 'Opening Balance'] = N: # Test if GL part of balance sheet If ( ElIsAnc ( 'GL Account', 'Balance Sheet', !GL Account ) <> 0, # Yes - balance sheet so calculate opening balance from last year DB ( 'Financial', Attrs ( 'Year', !Year, 'Prev' ), !Version, !Company, !Profit Centre, !GL Account, !Job, 'Year' ), # No - not balance sheet so set opening balance as 0 0 ); # This is the feeder (place it in the feeders block) ['Actual', 'Year'] => DB ( If ( ElIsAnc ( 'GL Account', 'Balance Sheet', !GL Account ) <> 0, 'Financial', '' ), Attrs ( 'Year', !Year, 'Next' ), !Version, !Company, !Profit Centre, !GL Account, !Job, 'Opening Balance' );