Forum Discussion
Two Calculated columns with RELATEDTABLE gives Circular Dependency
- Anonymous1 year ago
Hi hebe ,
You can try the following DAX to add calculated columns.Issued = VAR _SEL= CALCULATE ( COUNTROWS ( 'Status' ), ALLEXCEPT(Person,Person[Id]), 'Status'[Status] = "Issued" ) RETURN IF ( _SEL > 0, "Yes", "No" )Cancelled = VAR _SEL= CALCULATE ( COUNTROWS ( 'Status' ), ALLEXCEPT(Person,Person[Id]), 'Status'[Status] = "Cancelled" ) RETURN IF ( _SEL > 0, "Yes", "No" )
Please see the attached pbix for reference.Best Regards,
Dengliang Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
I created a sample file to display the problem:
https://1drv.ms/u/c/9f00986c82fa1657/ES1QHM3WKKFMuq8kc5DWiwUB4BOZIRGqEfLSWLAOfobaBA?e=psTQYg
The Calcluated Columns: "Issued" and "Cancelled" in the Person table are commented out since they create a Circular Reference if they are uncommented. Why am I not allowed to have more than one Calculate Column with RELATEDTABLE in the same table?
(Yes I know this is not the optimal solution, but this is how the source database looks like and I am aware that there are other (better) ways to solve this, but I want to know why this solution doesn't work 🙂 )
- Anonymous1 year agoNot applicable
Hi hebe ,
You can try the following DAX to add calculated columns.Issued = VAR _SEL= CALCULATE ( COUNTROWS ( 'Status' ), ALLEXCEPT(Person,Person[Id]), 'Status'[Status] = "Issued" ) RETURN IF ( _SEL > 0, "Yes", "No" )Cancelled = VAR _SEL= CALCULATE ( COUNTROWS ( 'Status' ), ALLEXCEPT(Person,Person[Id]), 'Status'[Status] = "Cancelled" ) RETURN IF ( _SEL > 0, "Yes", "No" )
Please see the attached pbix for reference.Best Regards,
Dengliang Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.