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
JGG
Helper I
Helper I

Suggestion on chart with many categories

Hi, this bar chart looks kind of silly but I want to show the variety of different customer care categories per day during a week. I don't mind all the cateogies that are small, I would like an easy way to see the name of the largest categories. A grouped bar chart I think is even worse. Is it possible to have something like top 5 categories and the rest as one group to see correct total? Any suggestions? 

JGG_0-1602857929226.png

 

JG

 

 

1 ACCEPTED SOLUTION

@amitchandak 

The problem with the solution from Curbal is it does not allow any segmentation of the data for a dynamic TopN.  It only ranks them based on the total in the data table.

 

@JGG 

You can create a category table that also contains an 'Other' entry that you join into your main data table.

 

Categories = 
UNION (
    DISTINCT ( 'Table'[Category] ),
    ROW ( "Category", "Other" )
)

 

Then you can write a measure like this to calculate the top 5 and group the rest in the 'Other' row.

 

Top 5 + Other
VAR Top_N =
    CALCULATETABLE ( Categories, TOPN ( 5, ALL ( 'Categories' ), [Amount] ) )
RETURN
    IF ( 
        NOT ISFILTERED ( 'Categories'[Category] ), CALCULATE ( [Amount], ALL ( 'Categories' ) ),
        IF ( SELECTEDVALUE ( 'Categories'[Category] ) = "Other",
            CALCULATE ( [Amount], EXCEPT ( ALL ( 'Categories' ), Top_N ) ),
            CALCULATE ( [Amount], INTERSECT ( 'Categories', Top_N ) )
        )
    )

 

[Amount] is simply the measure you are showing in your chart.

Then you replace the Category in your whart with the Category from the new Categories table you created (the one with the 'Other' row in it) to your chart.

 

View solution in original post

3 REPLIES 3
v-kelly-msft
Community Support
Community Support

Hi @JGG ,

 

Is your issue solved now?

If not,check the blog below:

https://www.sqlbi.com/articles/showing-the-top-5-products-and-others-row/

 


Best Regards,
Kelly

Did I answer your question? Mark my post as a solution!

amitchandak
Super User
Super User

@JGG , refer if this approach can help

https://www.youtube.com/watch?v=UAnylK9bm1I

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

@amitchandak 

The problem with the solution from Curbal is it does not allow any segmentation of the data for a dynamic TopN.  It only ranks them based on the total in the data table.

 

@JGG 

You can create a category table that also contains an 'Other' entry that you join into your main data table.

 

Categories = 
UNION (
    DISTINCT ( 'Table'[Category] ),
    ROW ( "Category", "Other" )
)

 

Then you can write a measure like this to calculate the top 5 and group the rest in the 'Other' row.

 

Top 5 + Other
VAR Top_N =
    CALCULATETABLE ( Categories, TOPN ( 5, ALL ( 'Categories' ), [Amount] ) )
RETURN
    IF ( 
        NOT ISFILTERED ( 'Categories'[Category] ), CALCULATE ( [Amount], ALL ( 'Categories' ) ),
        IF ( SELECTEDVALUE ( 'Categories'[Category] ) = "Other",
            CALCULATE ( [Amount], EXCEPT ( ALL ( 'Categories' ), Top_N ) ),
            CALCULATE ( [Amount], INTERSECT ( 'Categories', Top_N ) )
        )
    )

 

[Amount] is simply the measure you are showing in your chart.

Then you replace the Category in your whart with the Category from the new Categories table you created (the one with the 'Other' row in it) to your chart.

 

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!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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.