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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
mm_engstrom
New Member

Top N Within Matrix Table

Hi,

I have 3 columns of Data (Top 20 customers for 3 years). I would like to sort the table so it starts with the largest customer in the most recent year. Right now it seems like the 20 custoemrs are just presented randomly.

Thanks in advance

Michael

1 ACCEPTED SOLUTION

@mm_engstrom,

 

Currently, we can not sort your table by using two different column. To work around this issue, you could create another column.

Sample data
Capture.PNG
And then create a table bu using the DAX below.

Table =
ADDCOLUMNS (
    TOPN ( 20, Table1, Table1[Amount], DESC ),
    "rank", RANKX ( Table1, Table1[Year] * 10000 + Table1[Amount] / 10000,, DESC )
)

Capture1.PNG

Regards,

Charlie Liao

View solution in original post

3 REPLIES 3
miltenburger
Helper V
Helper V

Just click on the column header and it will sort automatically

 

Kind regards

Yes. That will work for the total column for the 3 years, but the total coulm is hidden. I would like to sort on the most recent year - not the total. Nothing happens when clicking on one of the coumns.

@mm_engstrom,

 

Currently, we can not sort your table by using two different column. To work around this issue, you could create another column.

Sample data
Capture.PNG
And then create a table bu using the DAX below.

Table =
ADDCOLUMNS (
    TOPN ( 20, Table1, Table1[Amount], DESC ),
    "rank", RANKX ( Table1, Table1[Year] * 10000 + Table1[Amount] / 10000,, DESC )
)

Capture1.PNG

Regards,

Charlie Liao

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 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.