Forum Discussion
Custom Sort Attribute row in unpivot matrix
I created a matrix and below is the format
| Attributes | 8/1/2021 | 8/2/2021 | 8/3/2021 | 8/4/2021 | 8/5/2021 |
| A | 234 | 234 | 23 | 23 | 689 |
| B | 45 | 345 | 234 | 234 | 689 |
| C | 3 | 345 | 234 | 234 | 689 |
but I want to custom sort the rows like below. Please help
| Attributes | 8/1/2021 | 8/2/2021 | 8/3/2021 | 8/4/2021 | 8/5/2021 |
| C | 3 | 345 | 234 | 234 | 689 |
| A | 234 | 234 | 23 | 23 | 689 |
| B | 45 | 345 | 234 | 234 | 689 |
- Anonymous5 years ago
Hi therenjithr ,
Here are the steps you can follow:
You can sort according to the customization of Power query.
1. Enter Power query through Transform data, select Add Column – Column From Examples – From All Columns.
2. Enter Index123 corresponding to ABC in the column next to it.
3. Select column [Attribute], Column tools – Sort by column – column [Custom].
4. Select Sort ascending in the column [Custom].
5. Result:
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
4 Replies
- mahoneypat
Microsoft Employee
You'll need to add a Sort By column to do that.
Sort one column by another column in Power BI Desktop - Power BI | Microsoft Docs
Pat
- therenjithrFrequent Visitor
This is the actual format of data. I created another table with index column and column name and then did the mapping in model. But in the visualization sorting doesnt work unless I add "Sort Column" as either in rows or columns.
Dates ColumnName Values SortColumn 8/1/2021 A 234 0 8/1/2021 B 135 1 8/2/2021 A 4123 0 8/3/2021 B 35 1 8/4/2021 B 233 1 8/5/2021 C 456 2 8/5/2021 C 243 2
- AnonymousNot applicable
Hi therenjithr ,
Here are the steps you can follow:
You can sort according to the customization of Power query.
1. Enter Power query through Transform data, select Add Column – Column From Examples – From All Columns.
2. Enter Index123 corresponding to ABC in the column next to it.
3. Select column [Attribute], Column tools – Sort by column – column [Custom].
4. Select Sort ascending in the column [Custom].
5. Result:
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
- therenjithrFrequent Visitor
I do not had to do step 2, but I used merge query to add mapped column from related table in actual table then followed ur steps on sorting, did the trick. Thanks for your effort.