Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredJoin us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.
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:
The matrix visual contains Product and Value [Measure].
Raw Data
Slicer
The order in which the products need to be sorted depends on the year value selected in the slicer.
Raw Data :
Table | ||
Product | Year | Value |
P3 | 2023 | 100 |
P2 | 2023 | 200 |
P1 | 2023 | 300 |
P8 | 2023 | 40 |
P6 | 2023 | 100 |
P1 | 2024 | 200 |
P3 | 2024 | 300 |
P2 | 2024 | 40 |
P14 | 2024 | 100 |
P12 | 2024 | 200 |
slicer : Year
2023
2024
Required order, when we click on slicer :
Order Required | |
2023 | 2024 |
Order | order |
P1 | P1 |
P2 | P2 |
P3 | P3 |
P6 | P12 |
P8 | P14 |
Solved! Go to Solution.
Hi @Madhu7624 ,
Thanks for the reply from BeaBF .
First, create a calculated column to extract the number of products.
ProductNumber =
VALUE(
MID('Table'[Product],2,2)
)
Then, create a calculated column to sort the numbers.
Order =
RANKX(
FILTER(
'Table',
'Table'[Year] = EARLIER('Table'[Year])
),
'Table'[ProductNumber],
,
ASC,
DENSE
)
Please create a matrix visual object for display. Drag Oder to the rows, Year to the columns, and Product to the values. the final visual is shown below:
The pbix file is attached.
If you have any other questions please feel free to contact me.
Best Regards,
Yang
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
Hi @Madhu7624 ,
Thanks for the reply from BeaBF .
First, create a calculated column to extract the number of products.
ProductNumber =
VALUE(
MID('Table'[Product],2,2)
)
Then, create a calculated column to sort the numbers.
Order =
RANKX(
FILTER(
'Table',
'Table'[Year] = EARLIER('Table'[Year])
),
'Table'[ProductNumber],
,
ASC,
DENSE
)
Please create a matrix visual object for display. Drag Oder to the rows, Year to the columns, and Product to the values. the final visual is shown below:
The pbix file is attached.
If you have any other questions please feel free to contact me.
Best Regards,
Yang
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
@Anonymous Yes but the RANKX is significantly more computationally expensive and resource-intensive compared to a simple sort by column operation, I recommend to use my process.
BBF
i have attached in question
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the October 2025 Power BI update to learn about new features.
User | Count |
---|---|
11 | |
6 | |
3 | |
3 | |
3 |
User | Count |
---|---|
11 | |
9 | |
8 | |
8 | |
7 |