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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
tksnota
Post Patron
Post Patron

Need Assistance on Error about Circular Dependency

Hi,

 

I managed to create a column for variance using the dax below

 

Variance = CALCULATE(SUM(GRV_SalesItems[Sales Price])) - CALCULATE(SUM(GRV_SalesItems[Purchase Price]))
 
 But when I tried to use a dax as shown below the Circular Dependency Error appears
tksnota_0-1724101678177.png

The same Circular Dependency is experienced when I tried to create a dax using If statement so I can create a slicer for variance classified as negative, positive and zero.

 

Hope someone can help.

 

//NT

1 ACCEPTED SOLUTION

Hi @tksnota ,

Please try the following formula:

Variance = ([Sales Price] - [Purchase Price]) / [Purchase Price]

vjiewumsft_0-1724144972955.png

Create the new column to classify the variance.

Variance classification = 
IF([Variance] > 0, "Positive", 
    IF([Variance] < 0, "Negative", "Zero")
)

Drag the date column into the slicer visual.

vjiewumsft_1-1724144984453.png

Best Regards,

Wisdom Wu

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

6 REPLIES 6
v-jiewu-msft
Community Support
Community Support

Hi @tksnota ,

Based on my testing, please try the following methods:

1.Create the sample table.

vjiewumsft_0-1724139514418.png

2.Create the new column to calculate the Variance.

Variance = CALCULATE(SUM('Table'[Sales Price])) - CALCULATE(SUM('Table'[Purchase Price]))

vjiewumsft_1-1724139524924.png

3.Create the new measure to calculate Margin instead of calculated column.

Margin01 = CALCULATE(SUM('Table'[Variance]) / SUM('Table'[Purchase Price]))

4.The result is shown below.

vjiewumsft_2-1724139541897.png

Best Regards,

Wisdom Wu

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

Hi,

 

Is it possible to make the variance as columns instead of measure so I can add it into a slicer?

 

Plus how can i make a slicer to classify the variance based on negative, positive and zero because I tried using the if function but again encountered circular dependency

 

//NT

 

//NT

Hi @tksnota ,

Please try the following formula:

Variance = ([Sales Price] - [Purchase Price]) / [Purchase Price]

vjiewumsft_0-1724144972955.png

Create the new column to classify the variance.

Variance classification = 
IF([Variance] > 0, "Positive", 
    IF([Variance] < 0, "Negative", "Zero")
)

Drag the date column into the slicer visual.

vjiewumsft_1-1724144984453.png

Best Regards,

Wisdom Wu

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

DaleT
Frequent Visitor

Hi,

 

This blog explains very well about this issue and also it provides the solution. Please refer to it. https://www.sqlbi.com/articles/avoiding-circular-dependency-errors-in-dax/ 

 

 

Dale

rubayatyasmin
Super User
Super User

Hi @tksnota 

 

Did you try using separate measures to classify variance? something like below,

Variance Classification =
VAR CurrentVariance = [Variance]
RETURN

 

see if these help:
Solved: Circular dependancy error - Microsoft Fabric Community

 

Solved: Circular dependency - Microsoft Fabric Community

 

Solved: Circular dependency.....why??? - Microsoft Fabric Community

 

Solved: Error: circular dependency - Microsoft Fabric Community
IF(
CurrentVariance > 0, "Positive",
IF(CurrentVariance < 0, "Negative", "Zero")
)


Did I answer your question? Mark my post as a solution!super-user-logo

Proud to be a Super User!


 

Hi,

 

I used your dax but still encountered a circular dependency as shown. Any possible option to fix my problem?

 

tksnota_0-1724142595241.png

 

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

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! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.