Forum Discussion
TopN + Others - Circular reference
Hi all,
I've been struggling with a formula for a few days now so I'm reaching out for help. I have read multiple articles and posts but still can't figure out what's causing the circular reference error in this statement. I'm following an example I found online for creating Top N and "other" for customer tickets. Below is my statement -
10 Replies
- amitchandakSuper User
Try like
CSTs TopN+Others = VAR RankCSTVolume = RANKX(ALLselected('CSTs from 2018 to current'),CALCULATE( SUM('CSTs from 2018 to current'[Service Tickets]) ),,DESC) return if (RankCSTVolume<=10, 'CSTs from 2018 to current'[Cat2andCat3], "Others") CSTs TopN+Others = VAR RankCSTVolume = RANKX(ALL('CSTs from 2018 to current'),CALCULATE( SUM('CSTs from 2018 to current'[Service Tickets]) ),,DESC) return if (RankCSTVolume<=10, 'CSTs from 2018 to current'[Cat2andCat3], "Others")- AnonymousNot applicable
Thanks amitchandak ... I think it's close. I'm still getting an error on the last statement -
if (RankCSTVolume<=10, 'CSTs from 2018 to current'[Cat2andCat3], "Others")
The error is - Cannot find name '[Cat2andCat3]'
Seems like a syntax error but I don't see why. It seems to only accept a caclulated field.
- amitchandakSuper User
Try like.
if (RankCSTVolume<=10, firstnonblank('CSTs from 2018 to current'[Cat2andCat3],blank()), "Others")
But row context is very important
Check how I have taken care of that in date diff :https://community.powerbi.com/t5/Community-Blog/Decoding-Direct-Query-in-Power-BI-Part-2-Date-Difference-Across/ba-p/934397#M451
- AnonymousNot applicable
Hi Anonymous ,
If the last post helps, then please consider Accept it as the solution to help the other members find it more quickly.