Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

Recursive calculation

Hi,

 

I have the following data

- Opening Volume

- Delivered Volume

- Sales Volume

- Estimated Volume

 

and would like to create a table with the following calculated columns:

- Opening Volume (N) = Closing Volume (N-1)

- Adjusted Volume (N) = Opening Volume (N+1) - [Opening Volume (N) + Delivered Volume (N) - Sales Volume (N)]

- Closing Volume (N) = Opening Volume (N) + Delivered Volume (N) - Sales Volume (N) + Adjusted Volume (N)

where N = Today, N-1 = Yesterday, and N+1 = Tomorrow

 

After trying with DAX, I am getting the circular dependency error in Power BI. Does anyone know of a workaround or have any suggestions on how best to approach the above?

 

Thanking you all in advance. 

 

4 REPLIES 4
Anonymous
Not applicable

Hi @Anonymous ,

 

You have already had Opening Volume in your table, why you want to use Closing Volume (N-1) to get the Opening Volume(N)?

 

Best Regards,

Jay

Anonymous
Not applicable

Hi @Anonymous,

 

I have the initial value of Opening Volume, but for subsequent Opening Volumes, I am required to use the Closing Volume from the previous day. If you refer to my screenshots in https://community.powerbi.com/t5/Desktop/Recursive-calculation/m-p/2276413/highlight/true#M826076, that might help explain things better. 

 

Regards,

Alex

bcdobbs
Community Champion
Community Champion

I'd start with 
Closing Volume (N) = Opening Volume (N) + Delivered Volume (N) - Sales Volume (N) + Adjusted Volume (N) 

given they're all today it should just work inside the existing row context.

I'm then assuming you have a date column so should be able to use CALCULATE to find the values for previous days. however you'll have to include ALLEXCEPT to stop your new columns going into context transition:
Avoiding circular dependency errors in DAX - SQLBI

If you share a demo pbix I can help put that into action.

 



Ben Dobbs

LinkedIn | Twitter | Blog

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!
Anonymous
Not applicable

Hi @bcdobbs, sorry, I don't seem to have the ability to upload a pbix file. 

I will try to explain using the images below and I hope this makes sense:

- my source data are columns A, B, E, F, G, and H

- values in row 1 for columns C and D are static

alexseng_0-1641863422878.png

- the remainder rows (row 2 onwards) of columns C and D, and columns J, K, L, M, N, P and Q are calculated with the formula displayed in the header

alexseng_1-1641863478459.png

 

What I am having difficulty with is to have the values calculated in column P (row n-1) populated into column D (row n). Similarly, I would like values calculated in column Q (row n-1) populated into column C (row n). Please see the highlighted texts in blue and green. 

 

Any guidance on how to approach the above problem would be greatly appreciated. Thanks. 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.