Forum Discussion

Pier8891's avatar
Pier8891
Frequent Visitor
2 years ago

Need Help Resolving Circular Dependency in Power BI for Average Margin Per Workshop Calculation

Hi everyone,

 

I'm new to using Power BI and I've run into a circular dependency issue that I'm struggling to resolve. I'm working on a report where I need to calculate the average margin of sales per workshop. I've already calculated the average margin per product, and there are several dependencies between tables that are already established in my data model.

 

Here's where I'm stuck: when I attempt to calculate the average margin per workshop using the already computed product margins, I encounter a circular dependency error. I've attached a screenshot to show the error and the context within my data model.

 

Could someone please guide me on how to resolve this? I want to understand not only how to fix this issue but also learn more about handling such scenarios in the future to improve my skills in Power BI.

 

Thank you for your assistance!

 

3 Replies

  • hi Pier8891 ,

    If I see correct you try add calculated column to your table to perform divison of sum of one measure over another. In this case you dont need to use RELATEDTABLE function as this is within same table. 

    Try this formula:

    Margen Medio per Workshop =
    DIVIDE(
    	SUMX('UNION VENTAS 19-21', [Beneficio neto por producto]),
    	SUMX('UNION VENTAS 19-21', [TOTAL VENTA])
    )

     

     

    I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!

    My LinkedIn: www.linkedin.com/in/lukasz-kozdron 

  • Pier8891's avatar
    Pier8891
    Frequent Visitor

    Hi StrategicSavvy,

     

    Thank you so much for your answer. I've resolved it. Your DAX didn't work, but I used a correct one from GPT.

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi Pier8891 

      Can you share the correct DAX expression that works? This may help other people who may have similar questions. Thank you. 

       

      Best Regards,
      Jing