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
shaunwilks
Helper V
Helper V

Matrix Sorting by First Level Then Second Level

I have a scenario I thought would be easily catered for but it appears it would not.

 

I am using Matrix when has two levels. 

 

For simplicity sake lets say the levels are 

1. Transaction Header (Say the total amount of an Invoice) First Field is the "Invoice Reference Number"

2. Transaction Lines (Each of the Items sold on that Invoice) - Second Field is the "Item Code" (That I want sorted by Item Category - Not in alpha)

 

The measures may be something like Qty, Price, Tax and Net Value

 

In the table Id like the lastest Invoices shown at the top.

Therefore I highlight the "Invoice Reference" field and Sort by Column "Trans Date" and in the martix I sort by this field and set it to Descending so I get the latest invoices to the top. Tick.

 

Now within the the next level I want to show the line in Item Code order.

I highlight the Item Code Field and want to sort by the category. I can try the sort by column but it wouldnt apply in my matrix anyway.

 

As the Visual only allows the setting of order by a single field how can I manipulate the order of the fields at the Transaction line level to show in a specific order ??

 

I have tried numerous combinations and eitehr get told I cant sort the Item Codes by the field I add to set their order in the data using "Sort by Column"

1 REPLY 1
v-juanli-msft
Community Support
Community Support

Hi @shaunwilks 

You have two levels in the row field like

Capture14.JPG

You want to sort by level 1, then sort by level 2, right?

If so, refer to the links below:

https://community.powerbi.com/t5/Desktop/Sorting-a-matrix-second-level-sort-by-column-not-working/td...

https://community.powerbi.com/t5/Desktop/Two-level-sorting-Matrix/td-p/507259

 

Best Regards
Maggie

 

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

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.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.