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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
o59393
Post Prodigy
Post Prodigy

Circular dependency - Very hard error to identfy

Hi all

 

I am getting a circular dependency error, which I have no clue how to fix because no major detail is given.

 

I will share the 3 dax I use:

 

1)

 

 

Production hours (bottler demand) = 

SUMX (
        SUMMARIZE (
            'SKU by line - Official',
            'Hours by line - Official'[Manufacturing plant],
            'Hours by line - Official'[Manufacturing line],
            'SKU by line - Official'[Merged Product],

"Production", SUM ('SKU by line - Official'[Demand by bottler]),
"UC per hour", [BPM Conversion Real]),

DIVIDE(
    [Production], 
    [UC per hour])
)

 

 

2)

 

Mix by Line Bottler (Hours) = 

DIVIDE(

CALCULATE(
    SUMX(
        'SKU by line - Official',
        'SKU by line - Official'[Production hours (bottler demand)]
    )
)
,
CALCULATE(
    SUMX(
        'SKU by line - Official',
        'SKU by line - Official'[Production hours (bottler demand)]),
        ALLEXCEPT(
            'SKU by line - Official',
            'SKU by line - Official'[Manufacturing plant of production],
            'SKU by line - Official'[Manufacturing line],
            'SKU by line - Official'[Date]
        )
    )
)

 

 

3)

 

 

3 - Capacity Bottler (Mix with Hours) = 

Var mix = 

CALCULATE(
    'SKU by line - Official'[Mix by Line Bottler (Hours)],

REMOVEFILTERS(
    'SKU by line - Official'[Capacity Bottler],
    'SKU by line - Official'[Calculated Column Capacity NSR (Mix UC)],
    'SKU by line - Official'[2 - Capacity NSR Hours (Mix Hours)])
)

Var result = 

         mix 
            * RELATED( 
                'Hours by line - Official'[Available Production Hours]
            )

return result

 

 

 

The error shows as:

 

o59393_0-1709181088390.png

 

 

Any idea how to fix this?

 

Thanks.

10 REPLIES 10
v-yaningy-msft
Community Support
Community Support

Hi, @o59393 

 

It is hard to determine what the cyclic dependency error is based on the DAX you provided, it needs to be combined with your data to determine that, you can either share the pbix file without sensitive data or break the chain by rewriting one or more of the metrics. One way is to use variables to store intermediate results and use them in subsequent calculations. Another way is to use the function to create a temporary table containing the results of one metric and then use that table when calculating another metric. Feel free to help you.


Best Regards,
Yang
Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

Hi  @v-yaningy-msft 

 

Did the file open?

 
Thanks.

Hi, @o59393 

Of course, I was able to open the file, and after troubleshooting, I can only determine now that it's related to this code below, which may take more time to test.

 

vyaningymsft_0-1709619702342.png

 

Best Regards,
Yang
Community Support Team

Thanks @v-yaningy-msft  appreciate your support. 

 

Let me know when you have news.

 

Regards.

Hi @v-yaningy-msft 

 

Do you have any news?

 

thanks

Hi, could you also share the file with me, or perhaps add a link in the comments for anyone interested to download? I'm keen on helping address the issues.

Thanks @v-yaningy-msft , sent you a msg.

 

Regards.

CupidC
Helper II
Helper II

check theses three measures, it might contain "All" / "values" in the syntax,  replace with distinct or allnonblank

 

CupidC_0-1709182252792.png

 

Hi @CupidC  not sure I understood 

 

where should I use the distinct part?

 

thanks 

can  you show us the formula of the three measures, it is hard to tell if they are causing errors.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

November Carousel

Fabric Community Update - November 2024

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

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.