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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
GKJARC
Resolver I
Resolver I

Sorting matrix table

Hi everyone,

 

I have a matrix table with a 4-level hierarchy (so four columns in the 'Rows' section): Customer name and Date.
The first column is Customer name which is sorted alphabetically ascending.
The other 3 columns I need sorted descending.

So the desired sort order would be like this:

- Customer A
     - A3
          01-03-2024
          01-12-2023
          01-06-2023
          01-10-2022
     + A2
     - A1
          01-06-2019
          01-04-2019
          01-03-2019
          01-10-2018
+ Customer B
+ Customer C

 

How can this be achieved?

Any help would be greatly appreciated.

Thanks!

1 ACCEPTED SOLUTION
Ritaf1983
Super User
Super User

Hi @GKJARC 
You need a "sort column" for every hierarchy level in your table with the needed order and sort the columns from the data view:

Ritaf1983_0-1711130807217.png

For a date column, you should use a date table create the column with the numeric date value and multiply it to (-1):

Ritaf1983_1-1711130915440.png

Ritaf1983_2-1711130951321.png

Result :

Ritaf1983_3-1711130999743.png

pbix is attached

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly

 

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

View solution in original post

2 REPLIES 2
GKJARC
Resolver I
Resolver I

@Ritaf1983 This works, thank you very much!
Be aware though that Number.From([Date]) doesn't always work well with datetime. For datetime I ended up using this SQL to get an inverted number from date: DATEDIFF(MINUTE, EE.ENTRYDATE, '2099-12-31T23:59:59') AS DateInvertedSorting

Ritaf1983
Super User
Super User

Hi @GKJARC 
You need a "sort column" for every hierarchy level in your table with the needed order and sort the columns from the data view:

Ritaf1983_0-1711130807217.png

For a date column, you should use a date table create the column with the numeric date value and multiply it to (-1):

Ritaf1983_1-1711130915440.png

Ritaf1983_2-1711130951321.png

Result :

Ritaf1983_3-1711130999743.png

pbix is attached

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly

 

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.