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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
Anonymous
Not applicable

How to find top N and remaining to be others

Hi Team,

 

From the following data i need to create a top 7 sales items and remaining should be keep it as others.Please let me know what is the formula to calcualte this.

 

ItemSales
pepsi25000
coc15000
macintosh5800
cadburry2500
7up1500
dew4500
expresso6900
oreo4500
Almond t450
cool bites1250
abc bis4560

 

Expected output

pepsi25000
coc15000
expresso6900
macintosh5800
abc bis4560
dew4500
oreo4500
others5700
1 ACCEPTED SOLUTION
Stachu
Community Champion
Community Champion

the only way I know to do this is to create a calculated column, grouping the non top 7 into 'others' bucket

Item2 = 
VAR ItemRank = RANK.EQ('Table'[Sales],'Table'[Sales])
RETURN
IF(ItemRank<=7,'Table'[Item],"other")

EDIT - syntax 



Did I answer your question? Mark my post as a solution!
Thank you for the kudos 🙂

View solution in original post

2 REPLIES 2
Stachu
Community Champion
Community Champion

the only way I know to do this is to create a calculated column, grouping the non top 7 into 'others' bucket

Item2 = 
VAR ItemRank = RANK.EQ('Table'[Sales],'Table'[Sales])
RETURN
IF(ItemRank<=7,'Table'[Item],"other")

EDIT - syntax 



Did I answer your question? Mark my post as a solution!
Thank you for the kudos 🙂

Anonymous
Not applicable

@Stachu thank you for the reply.I just got it by using the same lofic by using the RANKX function,

 

Thank you.

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

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

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.