Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hi all.
I'm facing with a circular dependency error and all I tried not solved.
I have 3 columns:
Column A
Column B
Column C
The value of the column C is
(A + [previous value of C]) - B
Some trick to achieve this?
This image show how I did this in excel
Thanks in advance
Solved! Go to Solution.
Hi @wellidyalmeida
This is called recursive calculation which is not supported by Power Bi as the DAX engine evaluates the calculated column or the measure at once.
However, there is a workaround and in this specific case it is not complicated. For this to work properly you need to specify the following:
1. The starting value for Column C
2. What you state as Column A, Column B & Column C, are they columns or measures?
Attached is a sample file tailored to match your requirement for both calculated column and measure options
C =
VAR StartingValue = 2000
VAR MinDate = MIN ( Table1[Date] )
VAR CurrentDate = Table1[Date]
VAR FilteredTable = FILTER ( Table1, Table1[Date] > MinDate && Table1[Date] <= CurrentDate )
VAR RecursiveValue = SUMX ( FilteredTable, [A] - [B] )
RETURN
StartingValue + RecursiveValue
Measure C =
VAR StartingValue = 2000
VAR SelectedDates = ALLSELECTED ( Table2[Date] )
VAR MinDate = MINX ( SelectedDates, Table2[Date] )
VAR CurrentDate = MAX ( Table2[Date] )
VAR FilteredTable = FILTER ( SelectedDates, Table2[Date] > MinDate && Table2[Date] <= CurrentDate )
VAR MeasuresTable = ADDCOLUMNS ( FilteredTable, "@A", [Measure A], "@B", [Measure B] )
VAR RecursiveValue = SUMX ( MeasuresTable, [@A] - [@B] )
RETURN
StartingValue + RecursiveValue
Solved!
The original solution from @tamerj1 is correct.
The sequence that calculated columns are evaluated caused the problem. My column C, beside the recursive calculation, has conditionals that gave me headache.
Hi, @tamerj1 , I need your help 🙂
The value of Column C is not correct.
I've been debuged every value used in the calculation, unfortunelly, I coundn´t understand what is wrong.
I used the COLUMN SOLUTION.
Can you help me, please?
I attached pbix and explaning it:
https://drive.google.com/file/d/1eX9hO1uNTAd1gaV3i57e-mvZ1kiqllfk/view?usp=sharing
Starting value is 359606 and come from the 'saldo inicial' table.
The calculated column is in the 'contas_vw' table in the column 'C'
The expected value is 181.737,87 but I got 182.367,83 as you can see in this image
Solved!
The original solution from @tamerj1 is correct.
The sequence that calculated columns are evaluated caused the problem. My column C, beside the recursive calculation, has conditionals that gave me headache.
Hi @wellidyalmeida
This is called recursive calculation which is not supported by Power Bi as the DAX engine evaluates the calculated column or the measure at once.
However, there is a workaround and in this specific case it is not complicated. For this to work properly you need to specify the following:
1. The starting value for Column C
2. What you state as Column A, Column B & Column C, are they columns or measures?
Attached is a sample file tailored to match your requirement for both calculated column and measure options
C =
VAR StartingValue = 2000
VAR MinDate = MIN ( Table1[Date] )
VAR CurrentDate = Table1[Date]
VAR FilteredTable = FILTER ( Table1, Table1[Date] > MinDate && Table1[Date] <= CurrentDate )
VAR RecursiveValue = SUMX ( FilteredTable, [A] - [B] )
RETURN
StartingValue + RecursiveValue
Measure C =
VAR StartingValue = 2000
VAR SelectedDates = ALLSELECTED ( Table2[Date] )
VAR MinDate = MINX ( SelectedDates, Table2[Date] )
VAR CurrentDate = MAX ( Table2[Date] )
VAR FilteredTable = FILTER ( SelectedDates, Table2[Date] > MinDate && Table2[Date] <= CurrentDate )
VAR MeasuresTable = ADDCOLUMNS ( FilteredTable, "@A", [Measure A], "@B", [Measure B] )
VAR RecursiveValue = SUMX ( MeasuresTable, [@A] - [@B] )
RETURN
StartingValue + RecursiveValue
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
10 | |
9 | |
8 | |
6 | |
5 |
User | Count |
---|---|
20 | |
14 | |
10 | |
9 | |
6 |