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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors