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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
StuartPQY
Frequent Visitor

Measure and sort in matrix

Hello

 

I am hoping someone can help with my challenge.  I have looked online and I may be overcomplicating my issue.

 

Screen shot of dashboard

 

StuartPQY_0-1750090446972.png

 

 

 

 

I have a measure that allows me to select Year, month, to compare data across years.  The matrix you can see has two measures.  Both feed from the DAX measure in Solved: Re: Dynamic Time comparison across multiple years - Microsoft Fabric Community.

 

I would like to order by values in the columns. But when I click on the triangle icon it does not sort correctly.  Can I sort my values in a column defined by a measure?

 

Thank you, 

 

Stuart

 

1 ACCEPTED SOLUTION
speedramps
Community Champion
Community Champion

You will laugh when I tell you the answer ....

 

Change the data type from Text to a Number

 

Text will sort alphabetically and left justify like this.

The promlem will fix itself when you use a number instead of text

 

Please click thumbs up and accept solution. Thank you !

 

3

301

32

4

405

43

 

 

 

View solution in original post

5 REPLIES 5
StuartPQY
Frequent Visitor

Hello
Thank you for the replies.  Pologies for the delay in reply, ive not been able to look at this PBI report at work.  I will do so today.

Thanks

 

Stuart

v-tsaipranay
Community Support
Community Support

Hi @StuartPQY ,

Thank you for reaching out to the Microsoft Fabric Community. Also thank you @speedramps , @maruthisp  and @Nasif_Azam   for your insights.


I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If the response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.


Thank you.

Nasif_Azam
Impactful Individual
Impactful Individual

Hey @StuartPQY ,

Thanks for sharing the screenshot and explaining your challenge. It looks like you're using a matrix visual in Power BI, displaying two DAX measures: one for Prior Year Actuals and one for Actuals. You're trying to sort the matrix by one of these measures, but the sorting doesn't work as expected. Let's go over why this might be happening and how to fix it.

There are 3 option to correct sorting

Option 1: Use a Single Dynamic Measure Instead of Two Static Measures

If you're using two separate measures like [Prior Yr Actuals] and [Actuals], consider creating one dynamic measure that returns the correct value based on slicer selections (like year or period offset). This way, you’ll only have one measure in the matrix, which makes sorting much more reliable.

Option 2: Switch to Table Visual Instead of Matrix

If you don't need the row/column hierarchy provided by the matrix visual:

  • Switch to a table visual, which allows sorting directly by measure columns more reliably.

  • Add [Supplier Name], [Prior Yr Actuals], [Actuals] as separate columns.

Option 3: Use a Sort Column

Create a calculated column to help sorting: SortOrder = SELECTEDMEASURE()

Then sort the matrix by that measure, using the Sort Order column (you may need to change visual type or tweak formatting).

 

For Detailed Information:

https://community.fabric.microsoft.com/t5/Desktop/Sort-Matrix-by-Measure/td-p/142742
https://community.fabric.microsoft.com/t5/Desktop/Sort-Matrix-by-Value-not-working/td-p/417722

 

If you found this solution helpful, please consider accepting it and giving it a kudos (Like) it’s greatly appreciated and helps others find the solution more easily.


Best Regards,
Nasif Azam

maruthisp
Solution Specialist
Solution Specialist

Hi StuartPQY,

 

Please change the Actuals column data type as Whole Number.
Also, you can sort 2 columns by using shift key on keyboard and click one by one column to sort on multiple columns in a visual.
One more thing, if youare using Text columns in calculations in mesaures then there might chances of error as well.

If this reply helped solve your problem, please consider clicking "Accept as Solution" so others can benefit too. And if you found it useful, a quick "Kudos" is always appreciated, thanks! 

 

Best Regards, 

Maruthi 

LinkedIn - http://www.linkedin.com/in/maruthi-siva-prasad/ 

X            -  Maruthi Siva Prasad - (@MaruthiSP) / X

speedramps
Community Champion
Community Champion

You will laugh when I tell you the answer ....

 

Change the data type from Text to a Number

 

Text will sort alphabetically and left justify like this.

The promlem will fix itself when you use a number instead of text

 

Please click thumbs up and accept solution. Thank you !

 

3

301

32

4

405

43

 

 

 

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.