Forum Discussion
RANKX Calc Column Circular Dependency
Tried the SQLBI articles but still can't get past this issue. I have no other calculated columns and no relationships to any other tables. I'm trying to create a calculated column of (conditional) ranks. Here is my data structure and what I'm trying to acheive (Type_X_Dollars_Rank). Every version of the RANKX formula I try keeps giving me a circular dependency error.
Because my dollars column is intentionally non-additive, the measure I used to generate the proper sum of the dollars (by Product_Index) is as follows: SUMX(DISTINCT(Table.ProductIndex),FIRSTNONBLANK(Table.Dollars,0))
| Product | Sub_Product | Department | Dollars | Product_Index | Table_Index (PK) | Product_Type | Type_X_Dollars_Rank |
| A | 12 | Home | $100 | 1 | 1 | X | 1 ($100 + $200 = $300) |
| A | 21 | Home | $100 | 1 | 2 | X | 1 ($100 + $200 = $300) |
| A | 33 | Work | $200 | 2 | 3 | X | 1 ($100 + $200 = $300) |
| B | 45 | Home | $300 | 3 | 4 | Y |
|
| B | 54 | School | $150 | 4 | 5 | Y |
|
| C | 62 | Work | $250 | 5 | 6 | X | 2 ($250) |
| C | 20 | Work | $250 | 6 | 7 | X | 2 ($250) |
| D | 71 | Home | $325 | 7 | 8 | Y |
|
| D | 74 | Home | $325 | 7 | 9 | Y |
|
3 Replies
- amitchandak
Super User
robarivas , I doubt that is sum Product_Index , if so sum for c will be 500
Try one of the two measures
Measure = Sumx(summzarize(filter(Table, Table[Product_Type] ="X"), [Product], [Dollars], ),[Dollars])
or
Measure = calculate(Sumx(summzarize(filter(Table, Table[Product_Type] ="X"), [Product], [Dollars], ),[Dollars]), allexpect(Table, Table[Product]))- robarivas
Post Patron
Thanks amitchandak but I think your response has to do with summing the dollars. My question/problem, however, is about the rankx function and the circular dependecy error it keeps giving me.
- AnonymousNot applicable
Hi robarivas ,
Here is a similar case, please check if it is helpful to you.
Circular dependency in Power Bi
If I have not understood your needs correctly, please do not hesitate to inform me.
Hope it helps,
Community Support Team _ Caitlyn Yan
If this post helps then please consider Accept it as the solution to help the other members find it more quickly.