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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

Circular dependency issue

I'm getting a circular dependency error that I can't figure out for the life of me.  To start, I have a fairly simple formula to calculate a value on a daily basis: 

(field1 + field3)/ (field1 + field2)

 

I want to display that as a daily value, as well as month-to-date and year-to-date. Using my actual field names, this is the formula:

 

prod_mwh + lost_prod_ext_mwh / prod_mwh + lost_prod_mwh
 
I then create measures for MTD and YTD which look like this (and maybe this is wrong and is part or all of the problem?):
 
oe_wo_ext_pct_mtd = DIVIDE(TOTALMTD(sum(oe_summary_report[prod_mwh]),oe_summary_report[date]) + TOTALMTD(sum(oe_summary_report[lost_prod_ext_mwh]),oe_summary_report[date]),TOTALMTD(sum(oe_summary_report[prod_mwh]),oe_summary_report[date]) + TOTALMTD(sum(oe_summary_report[lost_prod_mwh]),oe_summary_report[date]),0)
 
oe_wo_ext_pct_ytd = DIVIDE(TOTALYTD(sum(oe_summary_report[prod_mwh]),oe_summary_report[date]) + TOTALYTD(sum(oe_summary_report[lost_prod_ext_mwh]),oe_summary_report[date]),TOTALYTD(sum(oe_summary_report[prod_mwh]),oe_summary_report[date]) + TOTALYTD(sum(oe_summary_report[lost_prod_mwh]),oe_summary_report[date]),0)
 
I then have a target % field, which isn't calculated, it's just a static field for each plant.
 
So far, so good, my table looks like this:
OE 1.png
 
Now I need to show variances between Daily, MTD, and YTD vs. the Target. I create daily and MTD columns like this:
 
Daily Var = oe_summary_report[oe_wo_ext_pct] - oe_summary_report[oe_target_wo_ext_pct]
Monthly Var = oe_summary_report[oe_wo_ext_pct_mtd] - oe_summary_report[oe_target_wo_ext_pct]
 
And this is good so far:
oe 2.png
 
But when I create my YTD field, I get a circular reference error:
oe 3.png
 
I assume I'm doing something simple and obvious wrong, but can't figure it out. This is the last thing I need to finish a major project. Any ideas?
 
Thank you!
Alex
1 ACCEPTED SOLUTION

Hi Alex,

 

If we delete the column [oe_wo_mtd_compare], the [YTD Var] should work. I think you should create a measure instead. Which reference isn't available? Is it below you need?

Circular-dependency-issue

It's better to create a date to work with the time intelligence functions. 

 

Best Regards,

Community Support Team _ Dale
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-jiascu-msft
Employee
Employee

Hi Alex,

 

Did you create a column instead of a measure accidentally? 

Can you share a sample? Please mask the sensitive data first. Just see from your formula, it's simple and clear. 

 

Best Regards,

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

@v-jiascu-msft

 

Sorry, I forgot to include the file, which is here.

 

I created a column rather than measure because not all of the fields I wanted to reference were available when I tried to use a measure - that must be part of the problem. I spent some time this weekend learning DAX a little more deeply to see if I can get to the bottom of this, and suspect that the problem is that when I compare my MTD or YTD fields to the target value, the target value isn't an aggregate, it's just a static field on every row of data. So with MTD and YTD being aggregates, I'm thinking Power BI may not be able to find a specific row to get the target from. I'm going to try applying an average to that field and see if that might work.

 

If you do have time to take a look and can offer any other insight, it's much appreciated!

 

thanks

Alex

Hi Alex,

 

If we delete the column [oe_wo_mtd_compare], the [YTD Var] should work. I think you should create a measure instead. Which reference isn't available? Is it below you need?

Circular-dependency-issue

It's better to create a date to work with the time intelligence functions. 

 

Best Regards,

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

@v-jiascu-msft thanks for your help. I was able to get it all working! Once I studied up on DAX I realized I was trying to compare DAX measures to static fields, which of course caused problems, due to no current row, etc. 

 

Finally done, woo-hoo!

Anonymous
Not applicable

Hi Pozzyal,

 

Can you tell me what you did exactly to tackle the circular dependency error as I am facing the same issue while creating YTD values for my table.

 

Any response will be highly appreciated.

 

Thanks ,

Preetinder

Anonymous
Not applicable

In my case my YTD and MTD measures worked fine, but I then needed to compare them to another target column to determine the variance. But the other column wasn't a measure. So since my YTD and MTD fields were aggregates, they didn't have a single row to compare to in my target. Does that make sense?

Helpful resources

Announcements
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.