cancel
Showing results for 
Search instead for 
Did you mean: 
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

Accepted Solutions
Super User III
Super User III

Re: sort by index order

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.

Hamburg - Germany
If I answer your question, please mark my post as solution, this will also help others.
I accept Kudos :-), If you find my post helpful.

Proud to be a Datanaut!

View solution in original post

9 REPLIES 9
austinsense Impactful Individual
Impactful Individual

Re: sort by index order

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 🙂
Moderator v-yuezhe-msft
Moderator

Re: sort by index order

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.
Sea_and_Anne Helper I
Helper I

Re: sort by index order

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,
🙂

Super User III
Super User III

Re: sort by index order

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

Hamburg - Germany
If I answer your question, please mark my post as solution, this will also help others.
I accept Kudos :-), If you find my post helpful.

Proud to be a Datanaut!
Sea_and_Anne Helper I
Helper I

Re: sort by index order

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


🙂
Any other suggestion to solve this?

 

thanks in advance

Microsoft dkay84_PowerBI
Microsoft

Re: sort by index order

And you've confirmed that you're index or sort column data type is numeric?
Super User III
Super User III

Re: sort by index order

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.
Hamburg - Germany
If I answer your question, please mark my post as solution, this will also help others.
I accept Kudos :-), If you find my post helpful.

Proud to be a Datanaut!
Highlighted
Sea_and_Anne Helper I
Helper I

Re: sort by index order

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

Super User III
Super User III

Re: sort by index order

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.

Hamburg - Germany
If I answer your question, please mark my post as solution, this will also help others.
I accept Kudos :-), If you find my post helpful.

Proud to be a Datanaut!

View solution in original post

Helpful resources

Announcements
New Ranks Launched March 24th!

New Ranks Launched March 24th!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power BI Community!

‘Better Together’ Contest Finalists Announced!

‘Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Arun 'Triple A' Event Video, Q&A, and Slides

Arun 'Triple A' Event Video, Q&A, and Slides

Missed the Arun 'Triple A' event or want to revisit it? We've got you covered! Check out the video, Q&A, and slides now.

Join THE global Microsoft Power Platform event series.

Join THE global Power Platform event series.

Attend for two days of expert-led learning and innovation on topics like AI and Analytics, powered by Dynamic Communities.

Community Summit North America

Community Summit North America

Innovate, Collaborate, Grow. The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors