Power Query Problems

How to Fix Excel Data Model Circular References in Reverse Formulas

Nimra MalikNimra Malik Nov 2, 2026 868 views

Question details

The user needs to calculate values sequentially from the final row upwards using a recursive formula without triggering a circular dependency error in the Excel Data Model.

How to Calculate a Reverse Data Model Formula Without Circular References
Product
Excel Power Query
Device & OS
not provided
Scenario
Attempting to create a calculated column in the Excel Data Model that references the next row's value, resulting in a bottom-up sequential calculation requirement.
Observed behavior
Entering the recursive formula (e.g., pe(i)=pe(i+1)+...) in the Excel Data Model creates a circular dependency error, even though the exact same formula evaluates correctly in a standard Excel worksheet.
Before you start

Ensure your source data is formatted as a structured Excel Table (by selecting the data and pressing Ctrl+T) so it can be natively imported into Power Query Editor.

Solution 1Recommended

Use Power Query and List.Generate for Sequential Calculations

Bypass the Data Model's circular dependency limitations by performing the bottom-up calculation in Power Query using list generation before loading the final dataset.

Excel Data Model calculated columns evaluate the entire column at once, meaning any reference to previous or subsequent rows in the same column creates an evaluation loop. By using Power Query, you can perform these sequential step-by-step calculations safely before the data enters the Data Model.

1
Load Data into Power Query

Select your Excel Table, navigate to the Data tab on the ribbon, and click 'From Table/Range' to import your dataset into the Power Query Editor.

2
Buffer the Input Columns

In the Power Query Editor, click on 'Advanced Editor' under the Home tab. Add a custom step using the List.Buffer function for your required input columns. This caches the data in memory, preventing Power Query from re-evaluating the entire list on every iteration.

3
Apply List.Generate for Reverse Calculation

Create a new step utilizing the List.Generate function. Set your initial state to capture the final row's values, and construct your function to iterate backwards sequentially, applying your recursive logic for each preceding row.

4
Reverse the List and Add an Index

Because the calculation was performed bottom-up, apply the List.Reverse function to restore the original top-to-bottom row order. Next, go to 'Add Column' > 'Index Column' to add a sequential ID starting from 1 to both this generated list and your original table.

5
Merge Queries and Load to Data Model

Click 'Merge Queries' on the Home tab to join your newly calculated list back to the original table using the matching Index columns. Finally, click 'Close & Load To...', select 'Only Create Connection', and check the box for 'Add this data to the Data Model'.

Use Power Query and List.Generate for Sequential Calculations
Performance Consideration: Using List.Generate on very large datasets can be resource-intensive. Always use List.Buffer on your source columns prior to the recursive step to drastically reduce calculation times.
Free Microsoft Office alternative

Looking for a Lightweight Alternative to Heavy Excel Data Models?

Complex data models and deep Power Query formulas in Microsoft Excel can be overwhelming and resource-intensive. Try WPS Office as a free, lightweight, and highly compatible alternative for your daily spreadsheet calculations and data analysis needs.

  1. 1. Download and Install: Visit the official WPS website and download the free WPS Office suite for your operating system.
  2. 2. Open Your Excel File: Launch WPS Spreadsheet and open your existing .xlsx file directly without needing to convert it.
  3. 3. Enjoy Seamless Calculations: Experience smooth formula calculations and robust data processing natively within the application.
100% compatible with Microsoft Excel file formats (.xlsx, .xlsm, .csv)Lightweight installation with blazing-fast performance for sequential calculationsFamiliar user interface ensuring seamless migration with zero learning curveRobust built-in formula engine to handle row-by-row calculations directly in worksheets
microsoft office alternative - wps office

Frequently Asked Questions

Why do I get a circular dependency error in the Excel Data Model but not in a worksheet?

Worksheet cells calculate sequentially based on individual cell references, allowing for bottom-up or top-down flows. In contrast, Data Model calculated columns evaluate the entire column in a single pass. Referencing another row in the same calculated column creates an impossible evaluation loop.

What does the List.Generate function do in Power Query?

List.Generate is an advanced Power Query function that creates a list of values based on a starting condition, a condition for when to stop, and a calculation logic for the next step. This makes it the ideal solution for recursive or sequential calculations that mimic 'for' or 'while' loops.

Is there a simpler way to calculate recursive formulas without using Power Query?

Yes. If you only need the final result displayed on a sheet and do not require the data to reside inside the Power Pivot Data Model, you can type the formula directly into standard Excel worksheet cells. Standard worksheets handle row-by-row recursive references natively without triggering Data Model errors.