Forum Discussion
Adding Extra Fields to Sort Menu
- 1 year ago
Hi Anonymous ,
You're definitely running into a known limitation of the Gantt visual — it only allows sorting by fields that are used in specific roles and interpreted as measures.
Here’s a workaround that might help:
Create a measure version of your calculated column, like:
MySortMeasure = MAX('YourTable'[YourCalculatedColumn])This forces it into a measure context, which the visual can recognize for sorting.
Place that measure into the % Completion field (since you’ve disabled its default behavior). This will make it appear in the sort menu via the three dots.
Unfortunately, as you mentioned, the % Completion role only accepts one field at a time. If you want to switch between multiple sort fields dynamically, you can use a disconnected table and a slicer to control which measure is active — a technique known as dynamic sorting.
Here are some helpful Microsoft docs that explain sorting behavior in Power BI:
- Change how a chart is sorted in a report: https://learn.microsoft.com/en-us/power-bi/consumer/end-user-change-sort
- Sort one column by another column: https://learn.microsoft.com/en-us/power-bi/create-reports/desktop-sort-by-column
- Sorting options for custom visuals: https://learn.microsoft.com/en-us/power-bi/developer/visuals/sort-options
Let me know if you’d like help setting up the dynamic sort logic — happy to walk you through it.
If my response resolved your query, kindly mark it as the Accepted Solution to assist others. Additionally, I would be grateful for a 'Kudos' if you found my response helpful.
This response was assisted by AI for translation and formatting purposes.
Thankyou, burakkaragoz, RLSmart, for your response.
Hi 0045321,
We appreciate your question on the Microsoft Fabric Community Forum.
From what I understand, the feature you want to use is not fully possible in the current version of the Power BI Gantt visual. The Microsoft Gantt visual does not support sorting by multiple fields. It only allows sorting by certain data roles, and these roles let you sort by only one field at a time. Also, custom visuals have fixed functions, unlike table or matrix visuals where sorting is more flexible.
To solve this, we have created a workaround using a dynamic sorting solution with a disconnected table and a SWITCH measure:
- Created a disconnected table called SortOptions with options Sort by Priority and Sort by Risk.
- Created a DynamicSortMeasure using the SWITCH function based on the slicer selection.
- Used that measure in the % Completion role of the Gantt chart.
- Now, users can choose which field to sort by using the slicer.
- Sorting works as expected when users use the Gantt visual’s context menu by clicking the three dots (⋯) and selecting Sort by DynamicSortMeasure.
Please find the attached screenshot and sample pbix file for your reference:
We hope this information helps you solve the issue.
If you have any more questions, please feel free to ask in the Microsoft Fabric community.
Thank you.