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
Anonymous
Not applicable

need workaround for circular dependency

I have the data model as shown in the image below. 

I have two columns called A and B in my fact table, and a column named "employed more than 3 months" in my employee dimension table. (please ignore the other columns)

What I need is to have a column as following in my fact table: 

C= A- B

 

and then I need to have a column which produce the result as follow: 

 

result= IF [C <= 0 AND [employyed more than 3 months] = 'True'
THEN [C]
ELSE 0
END

 

 

I tried to create a calculated column with CALCULATE() function, but I receive a circular dependency error. 

 

can someone help me create this?

issue.PNG

 

1 ACCEPTED SOLUTION
v-cherch-msft
Employee
Employee

Hi @Anonymous 

I would suggest you create only one column like below.For further,please refer to below article.

https://www.sqlbi.com/articles/understanding-circular-dependencies/

https://www.sqlbi.com/articles/avoiding-circular-dependency-errors-in-dax/

Column =
IF (
    CALCULATE ( SUM ( [A] ) - SUM ( [B] ) ) < 0
        && RELATED ( Dim_EmployeeData[employyed more than 3 months] ) = "True",
    CALCULATE ( SUM ( [A] ) - SUM ( [B] ) ),
    0
)

Regards,

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-cherch-msft
Employee
Employee

Hi @Anonymous 

I would suggest you create only one column like below.For further,please refer to below article.

https://www.sqlbi.com/articles/understanding-circular-dependencies/

https://www.sqlbi.com/articles/avoiding-circular-dependency-errors-in-dax/

Column =
IF (
    CALCULATE ( SUM ( [A] ) - SUM ( [B] ) ) < 0
        && RELATED ( Dim_EmployeeData[employyed more than 3 months] ) = "True",
    CALCULATE ( SUM ( [A] ) - SUM ( [B] ) ),
    0
)

Regards,

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.