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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
Madhu7624
Regular Visitor

"Sorting Matrix Data Based on Slicer Selection

Hi Everyone,

I want to sort the data in a matrix in a specific order. When I select a value in the slicer, 

Below is the raw data image :

The matrix contains Product and Value [Measure].

Raw Data

Madhu7624_0-1736849169932.png

 

Slicer :

Madhu7624_1-1736849220335.png

 

The order in which the products need to be sorted on the year value selected in the slicer.

Madhu7624_2-1736849244682.png

 


Raw Data: 

Table
ProductYearValue
P32023100
P22023200
P12023300
P8202340
P62023100
P12024200
P32024300
P2202440
P142024100
P122024200



slicer 

slicer
Year
2023
2024


Order needed 

Order Required [ when I select year in Slicer ]
20232024
Orderorder
P1P1
P2P2
P3P3
P6P12
P8

P14


@BeaBF 

1 ACCEPTED SOLUTION
BeaBF
Super User
Super User

@Madhu7624 Ok, so create a custom column in Power Query with this code:

=Text.Middle([Product], 1, 3)
BeaBF_0-1736850253246.png

 

then load data and make Sort Product a Whole Number type:

BeaBF_2-1736850388229.png

 

Now click on Product column and choose this new one in "Sort by column"

BeaBF_1-1736850313815.png
 
It will be ordered as you want.
 
If it's ok please accept the answer as solution
 
BBF
 

View solution in original post

1 REPLY 1
BeaBF
Super User
Super User

@Madhu7624 Ok, so create a custom column in Power Query with this code:

=Text.Middle([Product], 1, 3)
BeaBF_0-1736850253246.png

 

then load data and make Sort Product a Whole Number type:

BeaBF_2-1736850388229.png

 

Now click on Product column and choose this new one in "Sort by column"

BeaBF_1-1736850313815.png
 
It will be ordered as you want.
 
If it's ok please accept the answer as solution
 
BBF
 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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