Forum Discussion
Reorder matrix columns and rows
Hi, apologies if this has been posted, but I couldn't find it.
As you can see from the image below, my headers are in numerical/ alpahabetical order. I would like to re-arrange them so they are in chronological order. I have created another column which allocates them a number 1 to 5, so I can order them in some bar charts I have, but am unable to do this in a matrix.
- Anonymous
There is no way to tell the matrix what sort by to use for the columns - this is done automatically based on the column settings.
Now that you have created the column in Power Query, please select the Duration column from the Fields pane on the far right. NOTE: You must click on the text for Duration (do NOT tick or untick the box next to it).
When you selcect the Duration column, if you are using the latest version of Power BI, you will see a Column Tools tab appear in the ribbon as per the post by @FahranAhmed
Click the Column Tools tab, then select Sort By Column.
Note you should still have the Duration column selected, so choose PCSort2 from this list.
Wait for Power BI to update, then your matrix should automatically reorder the columns for you.
You can also remove PCSORT2 from the matrix as Duration will be using that column now to sort every time it is used in any visual (including column and bar charts)
8 Replies
- amitchandak
Super User
Anonymous , hope you have marked that new column as the sort column for this column which you are using in rows and columns.
https://docs.microsoft.com/en-us/power-bi/desktop-sort-by-column
example
- FarhanAhmed
Community Champion
create a integer column in Power Query Editor ,
Assign numbers accoringly as per your sorting.
you will get the similar output.
- AllisonKennedy
Community Champion
Anonymous
It sounds like you know what to do - can you confirm that your column charts are working/sorting correctly? Sometimes I find that Power BI needs a reset, so try going to a different page and coming back, or try removing the column from the matrix and adding it back in.
If that still doesn't work, and you have used the "Sort by Column" button as per the link amitchandak posted, then we will need to know more about how you have set up the matrix in order to help you and also would be helpful to see a screenshot of the column charts that are working so we can see how you have set those up in comparison.- AnonymousNot applicable
bar chart workingbar chart workingnew column added to sortnot an option to sort
Hi, I hope these images help.
- FarhanAhmed
Community Champion
Option avaiable on Top Ribbon under Column Tools.
When you will click on column in table then Column tools tab will appear