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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
powowbi
Regular Visitor

Top N + Other based on dimensional attribute

Hi,

 

I need to create a top n and others column based on sales in the fact table. I can do this for a dimension directly linked to the fact table. However, I'm struggling to create one for a dimensional attribute.

 

For example, the fact table has a product key which links to the product table. I have created a top n products and others column based on the RANKX function and it works fine. But I need to create a top n colours and others column. Colour is an attribute in the product table and more than one product can share a colour.

 

I can't get the RANKX to focus on the colour column rather than the product table as a whole. I guess it's probably not possible. I would like to use this for other attributes so hoping not to have to add a colour key to the fact table.

 

I hope this makes sense and would greatly appreciate any advice or pointer to a solution.

1 ACCEPTED SOLUTION
powowbi
Regular Visitor

I managed to do this using the same RANKX based TopN+other column on a colours table joined to colours column in the Product table (1-many), so can still link back to sales table.

 

I guess I'll need more such tables if I need more TopN+others on attributes, but better than messing with the fact table. Model beginning to look more like snowflake.

 

Thanks for the pointer johnt75. It may have an even better answer but it was a frighteningly big article!

View solution in original post

2 REPLIES 2
powowbi
Regular Visitor

I managed to do this using the same RANKX based TopN+other column on a colours table joined to colours column in the Product table (1-many), so can still link back to sales table.

 

I guess I'll need more such tables if I need more TopN+others on attributes, but better than messing with the fact table. Model beginning to look more like snowflake.

 

Thanks for the pointer johnt75. It may have an even better answer but it was a frighteningly big article!

johnt75
Super User
Super User

The SQL BI guys have an excellent article on video on this - https://www.sqlbi.com/articles/filtering-the-top-products-alongside-the-other-products-in-power-bi/ . Should be possible to segment by any attribute on the product table.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.