Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
IDBdesign
Frequent Visitor

Measure - Handle Top N with Multiple Items having the Same Rank

Hi everyone,

 

I have a few reports where we rank top 3 concerns/comments by their negative sentiment score on a bar chart.  The issue I am running into is a case where occasionally there is more than 1 item with the same ranking/score, which results in more than 3 items being displayed on the bar chart.  I think the best solution might be to return the first item of each rank but I am not sure what the best approach for that is.  If someone could help point me in the right direction for addressing this issue (I'm sure it isn't a completely new one, however I wasn't able to find a similar question for it) that would be amazing.

 

Thank you in advance

IB

3 REPLIES 3
Anonymous
Not applicable

@IDBdesign 

FirstForEachRank = CALCULATE(FIRSTNONBLANK(Design[Item],TRUE()),TOPN(1,VALUES(Design[Item]),Design[Value]))

please try this calculated column 

Hello @Anonymous,

 

I am facing a circular dependancy issue when trying to use your calculated column as it conflicts with another one on the table.  Is there any way to circumnavigate this or is it possible to write it as a measure to only return True/False?

 

Rank Column (Cause of conflict):

Rank = 
RANKX( 
    ALLSELECTED('Data'[Department]), 
    CALCULATE(
        SUM( 'Data'[Sentiment Score])
    )
)

 

FirstForEachRank Column:

IsFirstOfRank = 
CALCULATE(
    FIRSTNONBLANK(
        'Data'[Comment],
        TRUE()
    ),
    TOPN(
        1,
        VALUES('Data'[Comment]),
        SUM('Data'[IsNegative])
    )
)

 

Error Message:

A circular dependency was detected: Data[Column], Data[Rank], Data[Column].

 

Kind Regards

IB

Anonymous
Not applicable

FirstForEachRank = CALCULATE(FIRSTNONBLANK(Sheet1[Item],TRUE()),TOPN(1,ALL(Sheet1[Item]),SUM(Sheet1[Value])))

@IDBdesign

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.