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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
aarontanek
Regular Visitor

Top N and Others

Hi Everyone,

I have 2 questions on Power BI and hope that someone is able to advise.

 

#1

The below table refers.

Fruit

Quantity

Apple

30

Kiwi

50

Orange

40

Watermelon

5

Pineapple

8

Total

133

 

I would like to sort the data in TOP 3; and the remaining park it as ‘Others’; something similar to the below.  Is this achievable using DAX?

 

Fruit

Quantity

Kiwi

50

Orange

40

Apple

30

Others

13

Total

133

 

#2

Can we dynamically change the column name in a table visual?

 

E.g. Quantity (2023) to auto default to current year: Quantity (2024)

Fruit

Quantity (2023)

Apple

30

Kiwi

50

Orange

40

Watermelon

5

Pineapple

8

Total

133

 

Thanks in advance!

1 ACCEPTED SOLUTION
SachinNandanwar
Super User
Super User

For your first requierement just create a calculated column

FruitName = IF(RANKX(ALLSELECTED('Fruit'),('Fruit'[Quantity]),,DESC,Dense)>3,"Others",Fruit[Fruit])

and use it in the table visual instead of the your original column from the table source .

SachinNandanwar_1-1722508233979.png

I am not sure if its possible to achieve your second requieremnt but I am hope I am wrong.The best that is possible based on my knowledge is create a measure 

Title = "Quantity" &  Year(TODAY()) & ""


and add it under  the title property of your table visual

SachinNandanwar_2-1722508374080.png

 



 



Regards,
Sachin
Check out my Blog

View solution in original post

2 REPLIES 2
SachinNandanwar
Super User
Super User

For your first requierement just create a calculated column

FruitName = IF(RANKX(ALLSELECTED('Fruit'),('Fruit'[Quantity]),,DESC,Dense)>3,"Others",Fruit[Fruit])

and use it in the table visual instead of the your original column from the table source .

SachinNandanwar_1-1722508233979.png

I am not sure if its possible to achieve your second requieremnt but I am hope I am wrong.The best that is possible based on my knowledge is create a measure 

Title = "Quantity" &  Year(TODAY()) & ""


and add it under  the title property of your table visual

SachinNandanwar_2-1722508374080.png

 



 



Regards,
Sachin
Check out my Blog
bhanu_gautam
Super User
Super User

@aarontanek , For first one Create a new table by going to modelling 

 

Top3AndOthers =
VAR Top3 =
TOPN(3, 'YourTable', 'YourTable'[Quantity], DESC)
VAR Others =
EXCEPT(ALL('YourTable'), Top3)
VAR OthersTotal =
SUMX(Others, 'YourTable'[Quantity])
RETURN
UNION(
SELECTCOLUMNS(Top3, "Fruit", 'YourTable'[Fruit], "Quantity", 'YourTable'[Quantity]),
ROW("Fruit", "Others", "Quantity", OthersTotal)
)

 

And create a measure for Total Quantity

   TotalQuantity = SUM('YourTable'[Quantity])
 
For second one you can create a measure
DynamicColumnName = "Quantity (" & YEAR(TODAY()) & ")"



Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.