Sort one column by another column in powerBI
Emmanuel Udoh
Posted on April 26, 2024
When you are given a task to complete and you find out that you need to sort a column by another column, for example, sorting the month name by the month number, this is what to do.
After you have added the month name to a visual, sometimes, it will be in alphabetical order; April, August, December and so on as shown in the picture below.
Sometimes, it might not be in alphabetical order. Don't panic. Just read on.
Set the column to use for sorting
To sort a column, you need a column with a number for each month in order to properly carry out the task. Any graphic in the report that has a sorted column will follow the order specified in the sorting. The months in the sample below are arranged alphabetically, but they ought to be arranged chronologically.
Steps to carry out this task:
- Select the column that you want to sort, in this case, month name. Note that the months in the graph are sorted alphabetically. In the Fields pane, the Column Tools tab becomes active.
- Select Sort by Column, then select the field you want to sort the other field by, which is, Month Number in this case.
- The graph automatically sorts chronologically by the number of months in a year.
Posted on April 26, 2024
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.