Forum Discussion
Circular Reference Error help
- 4 years ago
Hi MSUSPARTAN ,
I made sample data to simulate the problem and yes, the problem is there with this formula!
BoMtQtyRequiredcWhse ItemcComponentcAsphalt intermcAsphalt interm1
10 a 3abcd 10 5 a Zabcd 20 b 2PBabcd 20 4 c d 12 d 2PBABCs 12 The duplicated column show error with the formula you mentioned.
Reason looks to be use of CALCULATE in calculated column and Context transition. In this case, second column cal not be calculated untill the first is calculated.
This is well explained at below link:
https://www.sqlbi.com/articles/avoiding-circular-dependency-errors-in-dax/
Marco and Russo are expert of the topic, it is best to learn from thier original text.
Some key text I mention here for reference:
Let us start analyzing the first scenario: context transition in calculated columns. If you do not pay attention to circular dependencies, you cannot create more than one calculated column in a table – if the formula of the column contains CALCULATE anywhere. Indeed, CALCULATE in a calculated column performs a context transition and makes that column dependent on all the columns in the table. If two such columns exist, they depend on each other. Therefore, you experience circular dependency only once you have created the second column. The correct solution to avoid this is to restrict the list of columns that the calculated column depends on, by using ALLEXCEPT or REMOVEFILTERS and keeping only the table’s primary key. If the table has no primary key, then using CALCULATE in a calculated column is dangerous; this is because context transition is likely to produce unexpected results.Please modify the formula suitably.
Hope it helps.
Hi MSUSPARTAN ,
I made sample data to simulate the problem and yes, the problem is there with this formula!
BoMtQtyRequiredcWhse ItemcComponentcAsphalt intermcAsphalt interm1
| 10 | a | 3abcd | 10 | |
| 5 | a | Zabcd | ||
| 20 | b | 2PBabcd | 20 | |
| 4 | c | d | ||
| 12 | d | 2PBABCs | 12 |
The duplicated column show error with the formula you mentioned.
Reason looks to be use of CALCULATE in calculated column and Context transition. In this case, second column cal not be calculated untill the first is calculated.
This is well explained at below link:
https://www.sqlbi.com/articles/avoiding-circular-dependency-errors-in-dax/
Marco and Russo are expert of the topic, it is best to learn from thier original text.
Some key text I mention here for reference:
Let us start analyzing the first scenario: context transition in calculated columns. If you do not pay attention to circular dependencies, you cannot create more than one calculated column in a table – if the formula of the column contains CALCULATE anywhere. Indeed, CALCULATE in a calculated column performs a context transition and makes that column dependent on all the columns in the table. If two such columns exist, they depend on each other. Therefore, you experience circular dependency only once you have created the second column.
The correct solution to avoid this is to restrict the list of columns that the calculated column depends on, by using ALLEXCEPT or REMOVEFILTERS and keeping only the table’s primary key. If the table has no primary key, then using CALCULATE in a calculated column is dangerous; this is because context transition is likely to produce unexpected results.
Please modify the formula suitably.
Hope it helps.
- MSUSPARTAN4 years agoFrequent Visitor
Thanks for the help and explanation!