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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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