Forum Discussion

OlofA's avatar
OlofA
New Contributor II
10 months ago

Formula for same period previous year

I'm trying to write a business rule creating a KPI which returns the value of an account for same period previous year. I already have a working business rule creating a KPI which returns the value...
  • RobbSalzmann's avatar
    10 months ago

    This should do it:

    Dim currYear As Integer = api.Pov.Time.MemberId
    Dim lastYear As Integer = api.Time.AddYears(currYear, -1)
    Dim prevPeriod As String = api.Time.GetNameFromId(lastYear)
    
    Return api.Data.GetDataCell($"A#38999:T#{prevPeriod}").CellAmount