## Need Help: Circular Reference Error

Certified Master Anaplanner

## Need Help: Circular Reference Error

Hi Anaplan Community,

I have been thinking of ways to pull Prior Year value into Current Year. Previously, I used OFFSET() formular where I would offset -52 weeks. I have created a demo module below to showcase the original formula, the formula that give me circular reference error and the backup formula.

Recently, to adapt to 2023 having an additional week (53 weeks instead of 52 weeks), I wanted to get rid of offset (-52 weeks) formulas and decided to create the time system module below and then use it to lookup the Prior Year's weeks.

However, when I tried using the formula in the PY Revenue line = "Final Revenue[LOOKUP: 'SYS00 Time Setting Current Period'.'Prior Year Week List (Native)']", it's giving me a 'circular reference' error. I don't understand why OFFSET formula worked but my lookup PY Weeks formula does not. Can someone please help me understand this? Does anyone have any other elegant designs?

Formula for Default RevenueFormula for Final Revenue

5 REPLIES 5
Moderator

## Re: Need Help: Circular Reference Error

Instead of OFFSET can you try LAG(Final Revenue,y,z) and see if that works. Usually when there is a circular reference with OFFSET we use LAG.

Hope that helps

Misbah

<Miz Logix>

Certified Master Anaplanner

## Re: Need Help: Circular Reference Error

Hi Misbah,
I have no issue with using OFFSET, it's when I tried to use the formula "Final Revenue[LOOKUP: 'SYS00 Time Setting Current Period'.'Prior Year Week List (Native)']" and then it's given me a circular reference error.
Master Anaplanner/Community Boss

## Re: Need Help: Circular Reference Error

Couple of things:

1. Do you need the default revenue line? It might be easier to just reference the PY revenue line directly.

2. Can also put the "-52" element into the SYS module then you wouldn't need to have the IF... then... else... in your Option #2

As to lookup & ciruclar reference- i'm not sure what the answer is but to make lookup work to pull forward i've needed to break the formula linkage but offset gets around it. There's an article somewhere about it and will see if I can dig it up!

Andrew

Certified Master Anaplanner

## Re: Need Help: Circular Reference Error

Morning Andrew,
1. Yes I do need the default line, it helps the user to determine the starting point of their forecast. The example I provided is overly simplified of what we actually have in our model. I just stripped all the unnecessary information hoping to make my issue stand out.
2. good call!
Please let me know when you find the article.
Community Boss

## Re: Need Help: Circular Reference Error

To account the change in the number of weeks in a year use a time systems module to count the number of weeks. Add a new line item formatted by year and use parent(item(time)) to return the year for each month. Then finally add a third line item called number of months formatted as number. Reference the first line item and use LOOKUP to reference the full year value so that you return the number of weeks in the year for each week of the year.

Use this in your LAG or OFFSET function.

Chris
HeathcoteAndHerran.com