Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
10 years ago
Solved

Circular Reference in COUNTA

Hello,

 

I have a column filled with values of 2 types "Dated" and "Recent"

Skills[Review Status]

 

the following is working

Reviews Total Dated = CALCULATE(COUNTA(Skills[Review Status]),Skills[Review Status]="Dated")

 

I wanted to create another calculated column for the Recent values

Reviews Total Recent = CALCULATE(COUNTA(Skills[Review Status]),Skills[Review Status]="Recent")

 

But it returns the error

"A circular dependency was detected: Skills[Reviews Total Recent], Skills[Reviews Total Dated], Skills[Reviews Total Recent]."

 

Why is this happening and how can I fix it? And hopefully how to learn not to do it wrong next time?

 

Thank you

  • Anonymous

    Perhaps you should change it slightly.

    Total Reviews = COUNTA(Skills[Review Status])

    Reviews Total Dated = CALCULATE([Total Reviews], Skills[Review Status] = "Dated")

    Reviews Total Recent =CALCULATE([Total Reviews], Skills[Review Status] = "Recent")

    That way you are building on the first measure by filtering instead of doing different measures.

2 Replies

  • kcantor's avatar
    kcantor
    Community Champion

    Anonymous

    Perhaps you should change it slightly.

    Total Reviews = COUNTA(Skills[Review Status])

    Reviews Total Dated = CALCULATE([Total Reviews], Skills[Review Status] = "Dated")

    Reviews Total Recent =CALCULATE([Total Reviews], Skills[Review Status] = "Recent")

    That way you are building on the first measure by filtering instead of doing different measures.

  • wonga's avatar
    wonga
    Continued Contributor

    Anonymous

     

    This should work, because I have a similar situation and I don't get that error.

     

    Usually a "circular dependency" means you are referencing something that you are trying to change.

     

    Are you sure you should be using a calculated column for this? Wouldn't a measure be more appropriate since it's returning a number?

     

    In my case, I have them both as measures and NOT calculated columns.