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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
jdtobon88
Helper I
Helper I

measures that effectively need to circulate dependency

Regards,

We are trying to develop a MPS (Master Production Schedule) through power pivot and now we are facing a constraint related to a circular dependency which is not an issue when working Excel tables but in DAX we have not found a way to overcome this point. In words, we are trying to calculate an initial stock depending on the final stock in the previous period, however for the first period, the initial stock is given in a current stock table, then from a strictly logic point of view there is not a circular dependency, but from the DAX logic in the functions we are trying to use there is effectively a circular dependency.

 

jdtobon88_0-1635525071362.png

 

 

In the Excel file we have the Excel table example and the data model in power pivot until the point we are stuck.

The way we thought it would be possible is using the this formula for the Initial stock column:

 

Initial stock=VAR Period=[Period]
VAR Ref=[Product]
RETURN
IF([Period]=1;[Current Stock];
CALCULATE(SUMX(Tbl_Forecast;[Final Projected Stock]);FILTER(Tbl_Forecast;[Product]=Ref&&[Period]=Period-1)))

 

While the function for final projected stock column would be:

 

Final Projected Stock=[Initial stock]-[Forecast]+[Transit stock]+[New requirement]

 

I share the excel attachment with the model in dropbox

 

https://www.dropbox.com/scl/fi/w3gz792t47ifkvpjjgnnz/MPSModel.xlsx?dl=0&rlkey=uy8srwxssugzq25wnz1gx6...

 

1 REPLY 1
AlexisOlson
Super User
Super User

Unfortunately, recursion is not possible in DAX.

 

There are sometimes workarounds where you refactor your logic to be non-recursive. (See the links at the bottom of my StackOverflow answer for a couple more examples.)

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.