Derive PriorPeriod for a weekly calendar

RandyThompson
New Contributor III

My application has a weekly time dimension? I am trying to find a function that will derive prior weeks so I can calculate the Trailing8WeekAvg and Trailing26WeekAvg. I am able to get the last actual week via a literal value set by a combo-box. Based on the last actual week, I am trying to get the prior week.

I have tried  api.Time.GetPriorPeriod(api.Time.GetIdFromName("2025W8") and it returns the prior month 2025M1 not the prior week.

I also tried: 'Dim dPriorWk1 As Decimal = api.Data.GetDataCell("T#PeriodPrior1(2025W8)").CellAmount which passes the syntax validation but then returns an invalid script error. I have tried encompassing 2024W8 in [] or quotes and still get an invalid script error.

I also tried V#Trailing2MonthAvg and V#Trailing6MonthAvg but they only work for Months.

All suggestions are welcome. Thanks.

0 REPLIES 0