Forum Discussion
Header sort in Matrix visual
- 11 months ago
Hi, there's a circular dependency when you try to sort by Burn_Bucket by Sort Order, because in this table you have another column 'Burn Bucket' that depends on a measure [A_Actual_burn_%] which might create a loop.
I'd suggest creating a SortOrder table manually since it is quite small and connect it to your 'A_Backend_aggregation' with one-to-many, sort by this 'Burn_Bucket' by 'SortOrder' in this new table and use Burn_Bucket from this new SortOrder table for your Matrix visual.
https://drive.google.com/file/d/1tBzw_T1ZIHgh30cvzzGsbPm3K_oG_dZH/view?usp=sharing
Hi maverickf17 ,
You can resolve the sorting issue in your Power BI matrix visual by creating a dedicated sorting column. The problem occurs because Power BI is sorting the column headers as text, where "100%" comes before "40%" alphabetically. To fix this, you need to provide a numerical column to define the correct sorting sequence.
First, you'll need to create a new calculated column in your data table using a DAX formula. This column will assign a numeric value to each of your percentage categories, which will then be used to order them correctly. Navigate to the Data view in Power BI, select the appropriate table, and create a new column with the following DAX expression. Remember to replace 'YourTable'[Percentage Category] with the actual name of your table and column.
Sort Order =
SWITCH(
TRUE(),
'YourTable'[Percentage Category] = "100%", 100,
'YourTable'[Percentage Category] = "70%", 70,
'YourTable'[Percentage Category] = "50%", 50,
'YourTable'[Percentage Category] = "40%", 40,
0
)
After creating this new Sort Order column, you must apply this logic to your original percentage column. While still in the Data view, select the column that contains the text percentages (e.g., "100%", "70%"). Then, go to the Column tools tab in the ribbon and click on the Sort by Column option. From the dropdown menu that appears, choose the Sort Order column you just created.
Finally, return to the Report view and adjust the sorting directly on the matrix visual. Select your matrix, click the ellipsis (...) in the top-right corner, and choose to sort by your percentage category column. To achieve the desired order of 100%, 70%, 50%, and 40%, make sure the sort direction is set to descending. This will arrange the columns in the correct numerical sequence instead of the default alphabetical one.
Best regards,