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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
Anonymous
Not applicable

Sort Top 10 & Others table

Hello everyone,

 

I have created a table where I have the Top 10 customers by AR amount and all the rest customers' amounts are aggregated in Others.

I want to sort by AR amount descending and have always the Others at the bottom of the table.

 

Now when I sort by AR amount I get:

 

Customer                 AR

  Others             12,223,445

  Customer

       Amazon        3,415,788

       Costco          1,265,678

       Staples            674,789

       Walmart          354,897

            ...                      ...

            ...                      ...

       Total                     ...

   Total                         ...

 

 

What I want to have is like below:

 

Customer                 AR

  Customer

       Amazon        3,415,788

       Costco          1,265,678

       Staples            674,789

       Walmart          354,897

            ...                      ...

            ...                      ...

       Total                     ...

  Others             12,223,445

   Total                         ...

 

Could you please advise me on how I can make this type of sorting?

I would like to mention that the AR amount is a measure. that calculates the AR for Top 10, others and total.

For the Customers there is a table like that:

 Amazon        Customer

 Costco          Customer

 Staples          Customer

 Walmart        Customer

     ...               Customer

Others              Others

 

Thank you all.

 

Regards.

2 ACCEPTED SOLUTIONS
amitchandak
Super User
Super User

@Anonymous , not very clear, see if this can help

https://www.sqlbi.com/articles/filtering-the-top-3-products-for-each-category-in-power-bi/

top 5 with other

https://community.powerbi.com/t5/Desktop/Top-5-and-others/td-p/165945

 

For Rank Refer these links
https://radacad.com/how-to-use-rankx-in-dax-part-2-of-3-calculated-measures
https://radacad.com/how-to-use-rankx-in-dax-part-1-of-3-calculated-columns
https://radacad.com/how-to-use-rankx-in-dax-part-3-of-3-the-finale
https://community.powerbi.com/t5/Community-Blog/Dynamic-TopN-made-easy-with-What-If-Parameter/ba-p/367415

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

View solution in original post

v-diye-msft
Community Support
Community Support

Hi @Anonymous 

 

Seems like you'd wanna get the TOPN based on different category : Customer/Others, and show it in the matrix/table. but the category should be ranked as you wish by Custmer>Others, right?

 

You might refer to rank by multiple columns:

https://community.powerbi.com/t5/Desktop/How-to-order-by-column-name-and-measure-value/m-p/860531#M412845

I modified the measure as:

 

Measure 4 = 
VAR t =
    SUMMARIZE (
        ALLSELECTED ( 'Table (4)' ),
        'Table (4)'[Code Group],
        'Table (4)'[Name],
        'Table (4)'[Rank],'Table (4)'[Sales]
    )
RETURN
    COUNTROWS (
        FILTER (
            t,
            ISONORAFTER (
                    'Table (4)'[Code Group], SELECTEDVALUE ( 'Table (4)'[Code Group]), ASC,
'Table (4)'[Sales],SELECTEDVALUE('Table (4)'[Sales]),ASC
            )
        )
    )

 

That the code group ranks by asc, and sales ranks by desc:

3.PNG

 

Community Support Team _ Dina Ye
If this post helps, then please consider Accept it as the solution to help the other members find it more
quickly.

View solution in original post

3 REPLIES 3
tschris
Regular Visitor

I am adding as an alternative solution this one. I have added the respective files in github if one would need to download an existing example.

v-diye-msft
Community Support
Community Support

Hi @Anonymous 

 

Seems like you'd wanna get the TOPN based on different category : Customer/Others, and show it in the matrix/table. but the category should be ranked as you wish by Custmer>Others, right?

 

You might refer to rank by multiple columns:

https://community.powerbi.com/t5/Desktop/How-to-order-by-column-name-and-measure-value/m-p/860531#M412845

I modified the measure as:

 

Measure 4 = 
VAR t =
    SUMMARIZE (
        ALLSELECTED ( 'Table (4)' ),
        'Table (4)'[Code Group],
        'Table (4)'[Name],
        'Table (4)'[Rank],'Table (4)'[Sales]
    )
RETURN
    COUNTROWS (
        FILTER (
            t,
            ISONORAFTER (
                    'Table (4)'[Code Group], SELECTEDVALUE ( 'Table (4)'[Code Group]), ASC,
'Table (4)'[Sales],SELECTEDVALUE('Table (4)'[Sales]),ASC
            )
        )
    )

 

That the code group ranks by asc, and sales ranks by desc:

3.PNG

 

Community Support Team _ Dina Ye
If this post helps, then please consider Accept it as the solution to help the other members find it more
quickly.
amitchandak
Super User
Super User

@Anonymous , not very clear, see if this can help

https://www.sqlbi.com/articles/filtering-the-top-3-products-for-each-category-in-power-bi/

top 5 with other

https://community.powerbi.com/t5/Desktop/Top-5-and-others/td-p/165945

 

For Rank Refer these links
https://radacad.com/how-to-use-rankx-in-dax-part-2-of-3-calculated-measures
https://radacad.com/how-to-use-rankx-in-dax-part-1-of-3-calculated-columns
https://radacad.com/how-to-use-rankx-in-dax-part-3-of-3-the-finale
https://community.powerbi.com/t5/Community-Blog/Dynamic-TopN-made-easy-with-What-If-Parameter/ba-p/367415

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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