Forum Discussion
Strange! Unclear circulrar reference
I have 2 calculated columns:
Power BI desktop throws an error for the [Index] definition! : "A circular dependency was detected: Stocks[Weeks Bin], Stocks[Index], Stocks[Weeks Bin]."
5 Replies
- ValtteriNCommunity Champion
Hi,
I recommend reading this article by SQLBI: Understanding circular dependencies in DAX - SQLBI
Basically your second calculated column is referring to [weeks bin] even if you don't explicitly state it.
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: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/- RockManNew Member
I’m facing exactly the same issue. Earlier today, I updated Power BI to the August version, and I’m suspicious that it might be a bug. My formula is as follows:
"""DurationGroups=SWITCH(TRUE(),'Medidas'[_Duration In Minutes] <= 59, "Less than 1 hour",'Medidas'[_Duration In Minutes] <= 119, "More than 1 hour",'Medidas'[_Duration In Minutes] <= 179, "More than 2 hours",'Medidas'[_Duration In Minutes] <= 239, "More than 3 hours",'Medidas'[_Duration In Minutes] <= 299, "More than 4 hours",'Medidas'[_Duration In Minutes] <= 359, "More than 5 hours","More than 6 hours")"""
I also spent hours trying to find any correlation, but nothing. I really hope it’s not a bug but something I’m doing wrong. I don’t know what else to say. I’ll keep an eye out to see if anything comes up. - RockManNew Member
I THINK I managed to solve the problem, maybe… I followed the instructions from this video!: https://www.youtube.com/watch?v=CQHcZFk7pXc
In this way, I modified a previous formula that the new formulas used as follows:
Before:
"""
_Duration In Minutes =
SUMX(
'LTX',
HOUR('LTX'[Duration]) * 60 +
MINUTE('LTX'[Duration])
)
"""
After:
"""
_Duration In Minutes =
CALCULATE(
SUMX(
'LTX',
HOUR('LTX'[Duration]) * 60 +
MINUTE('LTX'[Duration])
),
ALLEXCEPT('LTX', 'LTX'[Video_ID])
)
"""I’m still testing, but it seems to have worked. Hope it helps!
- AhmadBakrHelper IV
I tried changing the difinition of the [Index] to be independent of [Weeks Bin], still got the same error. In the below [Weeks Bin] is not included in the calc col definition, yest same circular ref error!!!!!!!!
Index =SWITCH(TRUE(),[dispatch weeks] <= 2 , 1,[dispatch weeks] <= 4 , 2,[dispatch weeks] <= 6 , 3,[dispatch weeks] <= 8 , 4,[dispatch weeks] <= 10, 5,[dispatch weeks] <= 13, 6,[dispatch weeks] <= 26, 7,[dispatch weeks] <= 39, 8,[dispatch weeks] <= 52, 9,[dispatch weeks] > 52, 10)
I deleted both cols, defined only Index, went fine, defined [Weeks Bin] using a different col name 🙂 [Bin], still got a circular reference error to [Index]: "A circular dependency was detected: Stocks[Bin], Stocks[Index], Stocks[Bin]." - AhmadBakrHelper IV
Thank you very much for sharing this important post. I have not tried applying it yet, nevertheless I felt obliged to thank you once I finished reading it.
Once I apply it and hopefully it resolves the issue, I will be commenting again and marking the reply a solution.