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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
MagikJukas
Resolver III
Resolver III

Circular dependency - looking for suggestions

Hello,

I built in Excel a model that I wish to replicate in DAX.

the problem is that I get Circular depedency in DAX.

In Excel I do not get errors because the forumlas use Index and level to calculate in a given order, for instance:

Requirement from Above=IF([@Level]=0,[@Qty],SUMIFS([Missing Qty],[Material],[@[Father Above]],[Index],[@Index],[Level],"<"&[@Level]))
Stock available=MAX(0,[@Stock]-SUMIFS([Consumption],[Material],[@Material],[Index],"<"&[@Index]))

Consumption is the difference between those two fields, and missing Qty is requirement- consumption.

MagikJukas_0-1724840040165.png

 

How can I solve it in DAX?

clearly, it returns error as soon as two fields are linked to each other, ignoring the fact the formula structure avoids dependency at the same level.

 

regards

2 REPLIES 2
bhanu_gautam
Super User
Super User

@MagikJukas Instead of using SUMIFS, you can use DAX functions like SUMX or FILTER to iterate over tables and perform calculations.

DAX
RequirementFromAbove =
IF (
Table[Level] = 0,
Table[Qty],
CALCULATE (
SUM ( Table[MissingQty] ),
FILTER (
Table,
Table[Material] = EARLIER ( Table[FatherAbove] ) &&
Table[Index] = EARLIER ( Table[Index] ) &&
Table[Level] < EARLIER ( Table[Level] )
)
)
)

 

DAX
StockAvailable =
MAX (
0,
Table[Stock] -
CALCULATE (
SUM ( Table[Consumption] ),
FILTER (
Table,
Table[Material] = EARLIER ( Table[Material] ) &&
Table[Index] < EARLIER ( Table[Index] )
)
)
)

 

Consumption = Table[RequirementFromAbove] - Table[StockAvailable]

 

MissingQty = Table[RequirementFromAbove] - Table[Consumption]

 




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Hello,

thanks for your solution. the problem is that it creates a dependency with among the 4 column.

In Excel you can fix it by writing to sum the values earlier. In DAX it does not work. as soon two column have a potential dependency, you cannot calculate.

 

I am trying to understand if there are tricks to work around this problem.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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