
Microsoft MVP | Author | Speaker | Power BI & Excel Developer & Instructor | Power Query & XLOOKUP | Purpose: Making life easier for people & improving the quality of information for decision makers
In a recent YouTube video, Wyn Hopkins [MVP] walks viewers through a common pitfall in Microsoft Power BI: the so-called Sort By Column trap. The video explains why sorting categorical labels by a linked numeric or ordinal column can sometimes fail or behave unexpectedly. It also offers step-by-step fixes and practical guidance that are useful for both new and experienced report authors.
The video begins by explaining the basic purpose of the Sort By Column feature: to impose a logical order on text categories that would otherwise sort alphabetically. For example, month names or performance levels often need a business-defined order rather than the default alphabetical sequence. Wyn demonstrates how linking a display column to a numeric sort key produces predictable ordering across standard visuals when the relationship and granularity are correct.
Next, Wyn outlines the common scenarios that lead to trouble, starting with the familiar greyed-out option in the ribbon. He stresses that sorting will not work if the display column and the sort column do not live at the same granularity or if they exist in different tables without a correct relationship. Additionally, he highlights circular dependency errors that arise when a calculated sort column references the very column it is meant to reorder, which can break the model and block the sort action.
To resolve these issues, Wyn recommends building sort keys in the Power Query stage whenever possible, because doing so avoids many DAX circularity problems and reduces runtime dependencies. He also shows how to create a dedicated lookup table that holds category values and their sort keys, and then to use RELATED or a proper relationship to apply the sort safely. For cases where visuals behave oddly — such as pie charts reversing order or stacked charts misrendering — Wyn suggests adjusting the numeric direction, using ranking measures, or rebuilding the sort in Query Editor to ensure consistent representation.
Wyn carefully weighs the tradeoffs between computing sort order in Power Query versus using DAX. Query Editor provides stability and avoids dependency chains, but it requires editing the source steps and may be less flexible for user-driven or time-sensitive sorting logic. Conversely, DAX offers dynamic options like RANKX and measure-driven orders, but it increases the risk of circular dependencies and can complicate maintenance if many visuals rely on the same logic.
The presentation emphasizes that some visual types impose their own ordering logic, which can conflict with an applied sort key. For instance, matrix visuals and multi-column displays sometimes ignore the intended order, and pie charts may render segments in clockwise size order that feels reversed to the reader. Wyn encourages report authors to test the final visuals and to be prepared to invert sort values or adjust aggregation methods when a visual's internal behavior overrides the expected display.
Finally, Wyn summarizes practical rules that reduce future errors: keep sort columns in the same table or in a properly related lookup table, prefer Query Editor for static mappings, and use clear naming to avoid confusion between display and sort columns. He also notes ribbon and tool relocations in recent updates that moved the sort controls to Column or Measure Tools, which can create temporary confusion for users following older tutorials.
Overall, the video presents a balanced view that helps readers decide which approach fits their needs. While Query Editor increases stability and is usually simpler to maintain, DAX can provide essential flexibility for dynamic scenarios — but only if authors manage complexity carefully. By testing visuals and documenting the chosen approach, report authors can avoid the common pitfalls that Wyn highlights and deliver clearer, more reliable reports.
Power BI sort by column, Power BI sorting issue, sort by column trap, Power BI sort not working, fix Power BI sort order, Power BI sort by date problem, Power BI custom sort order, DAX sort by column