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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Sea_and_Anne
Helper I
Helper I

sort by index order

Hello,

I want to sort the data in the graphics by the index number, but it never appears in the correct way. C

So i have a column with the measures that are in this formula " 1 - name of measure" "2- name of mesure" ....."12-name of mesure"
I have created one new column that is only the number of measure "1","2",...,"12" and sorted by this new column and added a index to order the data. However in my graphs appears every time in other orther..could you please help me?

Sort by.png

thanks in advance.

 

 

1 ACCEPTED SOLUTION

Hmm,

 

maybe I'm still not getting the point ...

 

A simple bar chart looks like this:

 

Measures Unsorted.png

 

I'm sorting the column Measure by Column1, these are the steps

  • select the data tab
  • select the column: Measure
  • "Sort By Column": choosing "column1"

 

Measues Sorted by Column1.png

 

I'm getting this:

 

Measures Sorted.png

 

Finally I'm applying a Visual Filter to avoid the Total Measure, this may be necessary, due to the fact that blank values (Measure: Total) are sorted before the measures that have a proper value in the column Column1

 

Measures Sorted Avoiding Total.png

 

If this is not what you want, I guess you have to explain the outcome a little more.

 

Two questions:

What kind of visualization are you using (in my example I'm using "Clustered Bar Chart"

and what release of Power BI Desktop are you using.



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

View solution in original post

10 REPLIES 10
v-yuezhe-msft
Microsoft Employee
Microsoft Employee

Hi @Sea_and_Anne,

How do you use the “sort by column” feature in Power BI Desktop?  Firstly, in Query Editor, please add a index column to your table as shown in the following screenshot.
1.PNG

After clicking “Close & Apply”, in Report view, choose the column dragged into Axis in Fields panel, then click  “Sort By Column” and choose Index under Modeling ribbon.
2.PNG

Then check if your visual displays as expected.
3.PNG


Thanks,
Lydia Zhang

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

Hello,
Thank you for the solutions.
I tried both but i didn't got the expected result.
I've sorted by index in "Data" window but when i go to the report the "sort by" button is not active.

Error sort by index.png

 

 


Could you please help solving this issue?

Thanks in advance,
🙂

Hey,

 

as I understand you want to sort one column by another column.

 

In the DataView select the column that you want to be sorted. Then choose from the "Sort by Column" Menu the proper column that contains the index.

 

2017-01-02_13-07-13.png

 

Hope this helps



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

Thank you for the solution, I had already tried this but also didn't worked.


🙂
Any other suggestion to solve this?

 

thanks in advance

Hey,

it seems necessary that you provide a link to a simplified pbix-file that can be downloaded.

As we state, ordering one column by another column works in our scenarios, obviously this means that we are not able to reproduce this odd behavior in your scenario.


Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

Thanks,
i made an power bi example with dummy values. In this example it don't allow me to sort the other columns by the index, I didn't get the reason.

https://we.tl/Vo7fNwZPxK

 

Thank you for your help,

Mariana

Hmm,

 

maybe I'm still not getting the point ...

 

A simple bar chart looks like this:

 

Measures Unsorted.png

 

I'm sorting the column Measure by Column1, these are the steps

  • select the data tab
  • select the column: Measure
  • "Sort By Column": choosing "column1"

 

Measues Sorted by Column1.png

 

I'm getting this:

 

Measures Sorted.png

 

Finally I'm applying a Visual Filter to avoid the Total Measure, this may be necessary, due to the fact that blank values (Measure: Total) are sorted before the measures that have a proper value in the column Column1

 

Measures Sorted Avoiding Total.png

 

If this is not what you want, I guess you have to explain the outcome a little more.

 

Two questions:

What kind of visualization are you using (in my example I'm using "Clustered Bar Chart"

and what release of Power BI Desktop are you using.



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

I'm sorting the column Measure by Column1, these are the steps

  • select the data tab
  • select the column: Measure
  • "Sort By Column": choosing "column1"

This is THE KEY point. You have to *SELECT THE COLUMN YOU WANT SORTED* and then SORT BY INDEX FOR THAT COLUMN

And you've confirmed that you're index or sort column data type is numeric?
austinsense
Impactful Individual
Impactful Individual

If your index has the data type "Text" then it will sort like this ... { 1, 10, 11, 2, 3, 4 ... }

 

Two options to fix it:

  1. Change the data type to "Whole Number" - currently it might be "Text" or "Any"
  2. Keep the data type of the field "Text" but make the records look like this { 01, 02, ... 11, 12 } - that will sort correctly as text

 

Austin is VP Operations at PowerPivotPro and a professional self-service enthusiast 🙂

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.