I have a formula that needs to look a specific number of months back. The formula works when I type in the number of months as a hard code in the formula, but not when a use an line item containing the number of months.
A screenshot is below.

The Maturing Balance formula works. The Retained formula is the Maturing Balance line item x 97%. However, if I change the formula in Maturing Balance from LAG(Retained, 1 , 0) to LAG(Retained, Maturity months,0), I get a circular reference. I can't see any reason why replacing the hard code 1 with a line item containing a hard coded 1 would give a circular reference.
For this example, the module is dimensioned with a list containing only one item and no top level, and I have set all summary methods to none.
Can anyone help me out?
Edit: Blue print view below:
