Forum Discussion

AHaslett's avatar
AHaslett
New Contributor
22 days ago

Beginning Balance Formula

Our beginning balance formula is as follows:

'Check to see if we are in period 1
If api.Time.IsFirstPeriodInYear() Then

     .........

Else 

   ...............

This formula worked perfectly rolling from 2023 into 2024, but now in 2025 we are having issues. EX: In Feb 2025, the beginning balance is reverting back to Dec 24 instead of Jan 25. Any insight into where I might start in figuring out this error? I tried looking at our business rules for api.time and didn't see anything that stood out. 

Thanks!

 

  • T_Kress's avatar
    T_Kress
    Valued Contributor

    A normal BEGBALCALCYTD will always pull the prior ending balance into all periods of the current year.  This is typically done with an IF statement where if period 1 of the current year, it will pull the ending balance of the prior year.  Then IF periods 2 – 12 of the current year it can simply look back at period 1 of the current year.   And this is normally a member formula found in your Flow dimension.

    This is done for efficiency reasons.  You only want to look back at prior year once, in period 1.   Then in periods 2 – 12 you can simply pull that forward from period 1.  This is more efficient than every period in the current year having to look back at prior year.

    Here is that sample code, in a very simple form:

    Dim PeriodNum As Integer = api.Time.GetPeriodNumFromId(api.Pov.Time.MemberId) 
    
    If PeriodNum = 1 Then 
    api.Data.Calculate("F#BEGBALCALCYTD = RemoveNoData(F#ENDBAL:T#PovPriorYearM12)") 
    Else 
    api.Data.Calculate("F#BEGBALCALCYTD = RemoveNoData(F#ENDBAL:T#PovPrior)") 
    End If

    But is sounds like what you may want is a periodic BEGBALCALCMTD calculation instead.  This is one where each period simply needs to refer to the prior period’s ending balance.  This is not standard for a normal cash flow and beginning balance calculation, but you can add a member called BEGBALCALCMTD or BEGBALCALCPERIOD and get this calculation to work.

    It would be something like this:

         api.Data.Calculate("F#BEGBALCALCMTD = RemoveNoData(F#ENDBAL:T#PovPrior)")
    

     

  • JimmyReaves's avatar
    JimmyReaves
    New Contributor

    Can you post more of the code? None of what you posted looks wrong to me, but it's not much. So it would seem like the issue is in the "....." portions.