Forum Discussion

loloheat's avatar
loloheat
New Member
1 year ago
Solved

Creating Column with Formula

My formula keeps saying it is an error. How can you fix a circular dependency that was detected in the formula? It is something like this

Net Income Adjusted = [Revenue]-[Driver Pay]-[Fuel Cost]-[M&R Cost]-[Equipment Cost]-[Overhead Cost Adjusted]
  • Hi loloheat ,
    Circular dependency errors in DAX occur when a calculated column or measure depends on itself, either directly or indirectly. To resolve this, you need to break the dependency loop.

    For your specific case, you can try using variables to break the dependency. Here’s an example:

    Net Income Adjusted = 
    VAR Revenue = [Revenue]
    VAR DriverPay = [Driver Pay]
    VAR FuelCost = [Fuel Cost]
    VAR MRCost = [M&R Cost]
    VAR EquipmentCost = [Equipment Cost]
    VAR OverheadCostAdjusted = [Overhead Cost Adjusted]
    RETURN
        Revenue - DriverPay - FuelCost - MRCost - EquipmentCost - OverheadCostAdjusted

     

    By using variables, you ensure that each part of the calculation is evaluated independently, which can help avoid circular dependencies.

    If the issue persists, you might need to review the dependencies between your measures and calculated columns to identify and resolve any indirect dependencies.

     

    Let me know if this helps


    I hope this helps! 🎯
    If you found this answer helpful:
    ✔️ Mark it as the solution to help others find it faster.
    👍 Give it a kudo to show your appreciation!

  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi, loloheat 

    The circular dependency error you encounter is usually because the formula directly or indirectly references itself, making it unresolvable by Power BI. Maybe you can check the following links:

    Understanding circular dependencies in DAX - SQLBI

     

    Circular Dependency between Calculated Columns in ... - Microsoft Fabric Community

     

    How to Get Your Question Answered Quickly

    Best Regards

    Yongkang Hua

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

4 Replies

  • Greg_Deckler's avatar
    Greg_Deckler
    Community Champion

    loloheat Next to impossible to provide an answer with the information provided. Sorry, having trouble following, can you post sample data as text and expected output?
    Not really enough information to go on, please first check if your issue is a common issue listed here: https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882

    Also, please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

    The most important parts are:
    1. Sample data as text, use the table tool in the editing bar
    2. Expected output from sample data
    3. Explanation in words of how to get from 1. to 2.

  • Hi,

    It could be to do with your relationship set up or it could be that you're doing something like the below:

    • Column A = [Column B] + 1
    • Column B = [Column A] - 1

    If you do this above, then Power BI won't know what order to process things in and it creates a circular dependancy. Make sure the fields/measures you're using in that formula are independant.

    Please let me know if this helps.

     

     

  • Hi loloheat ,
    Circular dependency errors in DAX occur when a calculated column or measure depends on itself, either directly or indirectly. To resolve this, you need to break the dependency loop.

    For your specific case, you can try using variables to break the dependency. Here’s an example:

    Net Income Adjusted = 
    VAR Revenue = [Revenue]
    VAR DriverPay = [Driver Pay]
    VAR FuelCost = [Fuel Cost]
    VAR MRCost = [M&R Cost]
    VAR EquipmentCost = [Equipment Cost]
    VAR OverheadCostAdjusted = [Overhead Cost Adjusted]
    RETURN
        Revenue - DriverPay - FuelCost - MRCost - EquipmentCost - OverheadCostAdjusted

     

    By using variables, you ensure that each part of the calculation is evaluated independently, which can help avoid circular dependencies.

    If the issue persists, you might need to review the dependencies between your measures and calculated columns to identify and resolve any indirect dependencies.

     

    Let me know if this helps


    I hope this helps! 🎯
    If you found this answer helpful:
    ✔️ Mark it as the solution to help others find it faster.
    👍 Give it a kudo to show your appreciation!

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi, loloheat 

    The circular dependency error you encounter is usually because the formula directly or indirectly references itself, making it unresolvable by Power BI. Maybe you can check the following links:

    Understanding circular dependencies in DAX - SQLBI

     

    Circular Dependency between Calculated Columns in ... - Microsoft Fabric Community

     

    How to Get Your Question Answered Quickly

    Best Regards

    Yongkang Hua

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.