- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Sort years chronologically
I'm working on a dataset that has a country and a year columns. After doing the transformations in Power Query and loading to Power BI the sorting of the dataset in Data view is messed up. I would like to sort the data by country and then by year.
But for some reasons I cannot sort by two columns.
Is there anything I can do?
Is sorting the table in Dataview affects the visuals? Because when I make the line chart the years are not in chronological order
Please help.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Hi @AlphaTau
In PowerQuery, you can sort by multiple columns and create an index based on that sort.
Try this in PowerQuery:
1. Select the Country column and sort accordingly
2. Right-click the next column (Year) and sort accordingly.
At the far right of the column headers next to the down arrow to select/sort, you should see a tiny "1" or "2" next to Country and Year respectively.
3. Add a new Index column.
4. After you are done in PowerQuery, the Index should be available to sort by.
I hope this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Hi @AlphaTau
In PowerQuery, you can sort by multiple columns and create an index based on that sort.
Try this in PowerQuery:
1. Select the Country column and sort accordingly
2. Right-click the next column (Year) and sort accordingly.
At the far right of the column headers next to the down arrow to select/sort, you should see a tiny "1" or "2" next to Country and Year respectively.
3. Add a new Index column.
4. After you are done in PowerQuery, the Index should be available to sort by.
I hope this helps.

Helpful resources
Subject | Author | Posted | |
---|---|---|---|
Anonymous
| 03-03-2020 03:39 PM | ||
Anonymous
| 07-06-2018 08:03 AM | ||
03-20-2020 09:29 AM | |||
01-10-2023 03:16 AM | |||
11-01-2021 07:35 PM |
User | Count |
---|---|
136 | |
107 | |
88 | |
58 | |
46 |