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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
mbylicki
Frequent Visitor

Sort by another column - how to put group "others" always on the bottom in Matrix

Hello Community,

 

my data set looks like below:

BrandYearRegistrations
Audi20231
BMW20232
VW20233
Audi20221
BMW20222
VW20223
Dacia20224
Toyota20211
Dacia20212
VW20213

 

My goal is to show in Matrix TOP10 Brands in selected Year (separate slicer) and all other Brand show as "Other", but users want to see it always at the bottom of the list (no matter number of registrations)

I already have Measure for ranking: 

Brand Rank = RANKX(ALLSELECTED('Reg Ranking for Top Each Year'[Brand]), CALCULATE([registrations], ALLEXCEPT('Reg Ranking for Top Each Year', 'Reg Ranking for Top Each Year'[Brand]), 'Reg Ranking for Top Each Year'[Year] = SELECTEDVALUE('Reg Ranking for Top Each Year'[Year] )),,DESC,Skip)
and calculated column:
Brand Group = IF([Brand Rank] <= 10, 'Reg Ranking for Top Each Year'[Brand], "OTHER")
 
Do you have any idea how to sort Brand Group column to achieve my idea?
mbylicki_0-1690585014019.png it should looks like this.

I tried sort the Brand column by another but PBI says "There can't be more than one value in 'Custom Sort' for the same value in 'Brand group'

 

Thanks in advance for your support.
 
Maciej
1 REPLY 1
Jihwan_Kim
Super User
Super User

Hi,

I am not sure if I understood your question correctly, but I tried to create a sample pbix file like below.

One of ways to create a sort order is to create a new measure, and put the measure into the tooltip. And then, sort it by the measure.
I hope the below can provide some ideas on how to create a solution for your datamodel.

 

Please check the below pictures and the attached pbix file in the below.

 

 

1. Create Brand dimension table, and relate to the fact table.

Brand Dimension = 
UNION ( DISTINCT ( 'Data Fact'[Brand] ), { "Others" } )

 

Jihwan_Kim_2-1690612783156.png

 

 

2. create a measure that shows top3 and others.

Jihwan_Kim_4-1690613593357.png

 

 

Top 3 measure: =
VAR _topthreelist =
    SUMMARIZE (
        TOPN (
            3,
            ALL ( 'Brand Dimension'[Brand] ),
            CALCULATE ( SUM ( 'Data Fact'[Registrations] ) ), DESC
        ),
        'Brand Dimension'[Brand]
    )
VAR _topthreevaluetotal =
    CALCULATE ( SUM ( 'Data Fact'[Registrations] ), _topthreelist )
VAR _othersvaluetotal =
    CALCULATE (
        SUM ( 'Data Fact'[Registrations] ),
        ALL ( 'Brand Dimension'[Brand] )
    ) - _topthreevaluetotal
RETURN
    SWITCH (
        TRUE (),
        SELECTEDVALUE ( 'Brand Dimension'[Brand] ) = "Others", _othersvaluetotal,
        NOT ( HASONEVALUE ( 'Brand Dimension'[Brand] ) ), SUM ( 'Data Fact'[Registrations] ),
        CALCULATE ( SUM ( 'Data Fact'[Registrations] ), KEEPFILTERS ( _topthreelist ) )
    )

 

 

3. create a ranking measure for soring and put it into the tooltip.

ranking for sorting = 
IF (
    ISBLANK ( [Top 3 measure:] ),
    BLANK (),
    RANKX (
        ALL ( 'Brand Dimension'[Brand] ),
        CALCULATE ( SUM ( 'Data Fact'[Registrations] ) ),
        ,
        DESC
    )
)

Jihwan_Kim_5-1690613657168.png

 

4. Sort by ranking for sorting measure

Jihwan_Kim_6-1690613806592.png

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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