Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
bcdobbs
Community Champion
Community Champion

Column Sort Order Issue

Hi,

I have a central dataset that we maintain using Tabular Editor via XLMA end point.

 

I have a very simply dimension table:

bcdobbs_0-1661440111787.png

In tabular editor I have the sort by column set:

bcdobbs_1-1661440166421.png

 

However when I then connect to it in Power BI Desktop  and create a basic line chart, the sort order is not taken account of:

bcdobbs_2-1661440235960.png

Have checked the sort order on the visual:

bcdobbs_3-1661440277688.png

 

Am I missing something obvious either in tabular editor or PBI Desktop.



Ben Dobbs

LinkedIn | Twitter | Blog

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!
1 ACCEPTED SOLUTION

Hi Todd, 

Thanks for replying.

 

I'm connecting live to a data set so the sort by column option in power bi desktop is greyed out:

bcdobbs_0-1661443444131.png

Would expect that as it's a property of the dataset.

 

I've actually just fixed it (need to work out what's going on under the service in the engine though).

 

By recording the query in PBI desktop for the visual I found that the sort column is being thrown into the query which is good (means it knows it is the sort column) but second in the sort order:

// DAX Query
DEFINE
  VAR __DS0FilterTable = 
    TREATAS({"AMA"}, 'Site'[Academy Code])

  VAR __DS0FilterTable2 = 
    TREATAS({"2021/2022"}, 'Calendar'[Academic Year])

  VAR __DS0FilterTable3 = 
    TREATAS({"Projected"}, 'Grade Types'[GradeType])

  VAR __DS0Core = 
    SUMMARIZECOLUMNS(
      'CAF Slot'[CAFSlot],
      'CAF Slot'[DisplayOrder],
      __DS0FilterTable,
      __DS0FilterTable2,
      __DS0FilterTable3,
      "Basics_4_", 'KS4 Statistics'[Basics 4+]
    )

  VAR __DS0PrimaryWindowed = 
    TOPN(1001, __DS0Core, 'CAF Slot'[CAFSlot], 1, 'CAF Slot'[DisplayOrder], 1)

EVALUATE
  __DS0PrimaryWindowed

ORDER BY
  'CAF Slot'[CAFSlot], 'CAF Slot'[DisplayOrder]

 

Going back to tabular editor I had CAFSlot flagged as a Key column (which it is). Removing that flag fixed the issue.



Ben Dobbs

LinkedIn | Twitter | Blog

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!

View solution in original post

2 REPLIES 2
ToddChitt
Super User
Super User

Can you verify that your Sort By Column is correct by checking it in the Column Tools menu item of the same name?

And can you show the entire visual?




Did I answer your question? If so, mark my post as a solution. Also consider helping someone else in the forums!

Proud to be a Super User!





Hi Todd, 

Thanks for replying.

 

I'm connecting live to a data set so the sort by column option in power bi desktop is greyed out:

bcdobbs_0-1661443444131.png

Would expect that as it's a property of the dataset.

 

I've actually just fixed it (need to work out what's going on under the service in the engine though).

 

By recording the query in PBI desktop for the visual I found that the sort column is being thrown into the query which is good (means it knows it is the sort column) but second in the sort order:

// DAX Query
DEFINE
  VAR __DS0FilterTable = 
    TREATAS({"AMA"}, 'Site'[Academy Code])

  VAR __DS0FilterTable2 = 
    TREATAS({"2021/2022"}, 'Calendar'[Academic Year])

  VAR __DS0FilterTable3 = 
    TREATAS({"Projected"}, 'Grade Types'[GradeType])

  VAR __DS0Core = 
    SUMMARIZECOLUMNS(
      'CAF Slot'[CAFSlot],
      'CAF Slot'[DisplayOrder],
      __DS0FilterTable,
      __DS0FilterTable2,
      __DS0FilterTable3,
      "Basics_4_", 'KS4 Statistics'[Basics 4+]
    )

  VAR __DS0PrimaryWindowed = 
    TOPN(1001, __DS0Core, 'CAF Slot'[CAFSlot], 1, 'CAF Slot'[DisplayOrder], 1)

EVALUATE
  __DS0PrimaryWindowed

ORDER BY
  'CAF Slot'[CAFSlot], 'CAF Slot'[DisplayOrder]

 

Going back to tabular editor I had CAFSlot flagged as a Key column (which it is). Removing that flag fixed the issue.



Ben Dobbs

LinkedIn | Twitter | Blog

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.