# RANKX Calculated Column returning Circular Dependency



## zapppsr (Oct 4, 2017)

Hi!

I have a scenario here:








I used RANKX to rank 13 "Regionais" based on the Column "Crescimento":

MEASURE Ranking = 
RANKX (
    ALLEXCEPT(  fCrescimento ;fCrescimento[Ano]);
    CALCULATE ( MAX ( fCrescimento[Crescimento] ) );
    ;
    ;
    DENSE
)


So far so Good. I got what I wanted about the results. It ranks correctly. The problem is that I'm using a MEASURE and I need a COLUMN Because I want to use the Rank 1, 2, 3 and so on to make a relationship with another table that has points for each ranking. And later on I will have to combine this points with other rankings in other tables... so I think it is better that they are visible in a column.

When I try to use this RANKX in a column, I get a circular dependency error.

Question: Can I have the result I want for the raking in a calculated column instead of a measure?


------------------------------------------

Crescimento is kinda complex:

COLUMN Crescimento = 
VAR AA = fCrescimento[Ano] - 1

VAR ValorAC = CALCULATE(MAX(fCrescimento[Valor]))

VAR ValorAA =
    CALCULATE(CALCULATE (
        MAX ( fCrescimento[Valor] );
        ALL ( fCrescimento );
        VALUES ( fCrescimento[Regional] );
        fCrescimento[Ano] = AA
    ))

VAR Cre = DIVIDE(ValorAC-ValorAA;abs(ValorAA))   

RETURN Cre


----------

