Hi Paul,

You can't and you don't need to self-reference.

Formula are calculated in a context, we need to define the proper context.

Your formula

(D2*E2)+(G1-F2) can be transformed as:

(D2*E2)+(D1*E1)-F2)

(D3*E3)+(D2*E2)+(D1*E1)-F2-F3) and so on

==> iterator

This code should work

```
Result =
VAR CurrentDate = MAX( 'Table'[Start of Month] )
VAR PreviousRow = CALCULATE( MAX( 'Table'[Start of Month] ), 'Table'[Start of Month] < CurrentDate )
VAR PreviousReceiptsIssued =
CALCULATE(
SUM( 'Table'[Receipts issued] ),
REMOVEFILTERS( 'Table'[Start of Month] ),
'Table'[Start of Month] < CurrentDate
)
VAR G =
CALCULATE(
SUMX(
'Table',
'Table'[%AvgPercentageOfReceiptsissued This Month(All Years)]
* 'Table'[AvgYearlyReceiptsissued(All Years)]
),
REMOVEFILTERS( 'Table'[Start of Month] ),
'Table'[Start of Month] <= CurrentDate
)
RETURN
G - PreviousReceiptsIssued
```

Here is the result:

There is discrepancy with your expected result, but applying your formula in Excel gives the same result.

If I missed anything, let me know.

Checked by yourself in the pbix uploaded

ITERATOR ITERATOR ------------------------------

Marc Schroyen

Liège Belgium

------------------------------

Original Message:

Sent: Jun 29, 2022 12:00 AM

From: Tom Paulson

Subject: How to reference within a calculated column?

------------------------------

Tom Paulson

------------------------------