Forum Discussion

marisolbritton's avatar
marisolbritton
New Contributor III
2 years ago

Daily Average Calc

Does anyone know how to write a formula that calculates an average based on the POV's number of days? Thanks

  • ChristianW's avatar
    ChristianW
    Valued Contributor

    you can access the number of days like this:

    BrApi.Finance.Time.GetNumDaysInTimePeriod(si, timeId)

    or in a finance business rule or member formula:

    api.Time.GetNumDaysInTimePeriod(timeId)

    • marisolbritton's avatar
      marisolbritton
      New Contributor III

      Thanks Christian!  Do you happen to have a sample?  Thanks in advance

      • ChristianW's avatar
        ChristianW
        Valued Contributor

         

         

         

        Dim timId as Integer = BrApi.Finance.Members.GetMemberId(si, DimTypeId.Id, “2023M1”)
        Dim numDays = BrApi.Finance.Time.GetNumDaysInTimePeriod(si, timId)
        
        Dim timId as Integer = api.Members.GetMemberId(DimTypeId.time, “2023”)
        Dim numDays as Integer = api.Time.GetNumDaysInTimePeriod(timeId)