cancel
Showing results for 
Search instead for 
Did you mean: 
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
August 2022 update 768x460.jpg

Check it Out!

Click here to learn more about the August 2022 updates!

August 1 episode 9_no_dates 768x460.jpg

The Power BI Community Show

Watch the playback when Priya Sathy and Charles Webb discuss Datamarts! Kelly also shares Power BI Community updates.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Top Solution Authors
Top Kudoed Authors