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

Get Fabric certified for FREE! Don't miss your chance! Learn more

Reply
dave_f
New Member

TOP N Issue - Please help!

Hi - 

I have a dataset where there are duplicate IDs because a client might be generating revenue in more than one Line of Business.  The structure of the data can't change.

I'm using the following formula to get the Top N using a Top N slicer:

 

Revenue LOB Top N =
var _RevenueLOBTopN =
CALCULATE([Total Sum], TOPN([Selected N],'LOB Top N',[Total Sum],DESC,'LOB Top N'[Client Name with GCID]))
RETURN
if(ISBLANK(_RevenueLOBTopN),0,_RevenueLOBTopN)
 
I need to add something into this formula that would look for duplicate IDs, sum the revenue of these duplicate ID's, and then rank them accordingly.  Perhaps the way I'm ranking them is incorrect?  Here's my rank measure: 
Client LOB Rank = RANKX(ALL('LOB Top N'[Client Name with GCID]),'LOB Top N'[Total Sum])
 
If I were to put these companies into a table with just two columns, company name and revenue, the revenue is summed correctly, but in the Revenue LOB Top N measure, it's incorrect.
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @dave_f ,

 

Please try this:

Client LOB Rank = RANKX(ALLSELECTED('LOB Top N'[Client Name with GCID]),'LOB Top N'[Total Sum])

If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.

 

Best Regards,

Neeko Tang

If this post  helps, then please consider Accept it as the solution  to help the other members find it more quickly. 

 

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi @dave_f ,

 

Please try this:

Client LOB Rank = RANKX(ALLSELECTED('LOB Top N'[Client Name with GCID]),'LOB Top N'[Total Sum])

If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.

 

Best Regards,

Neeko Tang

If this post  helps, then please consider Accept it as the solution  to help the other members find it more quickly. 

 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

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.