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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Power BI Sort by Column issue

Hi,
I opened a blank report and added a new table:

Table = DATATABLE("Name", STRING, "Ord", INTEGER, {
{"X",1},
{"Y",2},
{"X",3}
})
When trying to sort column Name by column Ord I get an error: We can't sort the 'Name' column by 'Ord'. There can't be more than one value in 'Ord' for the same value in 'Name'.
So I delete the last entry in the table code:
Table = DATATABLE("Name", STRING, "Ord", INTEGER, {
{"X",1},
{"Y",2}
})
But I still have the same error when trying to sort Name by column Ord. However, if save the report, close Power BI and reopen the report then it works. Bug?
Moreover, after sorting Name by Ord, I can add the {"X",3} back in the table code and it works. Then why not woring from the beginning?!
2 ACCEPTED SOLUTIONS
lbendlin
Super User
Super User

There was a bug in version 2.139.1733.0 - use a different version.  Your example works fine with 2.139.2054.0 , for example

View solution in original post

Anonymous
Not applicable

Hi @Anonymous,

Thanks for the reply from @lbendlin, I could not roll back to an earlier version to reproduce your issue, try to update to a new version like lbendlin mentioned and check if it could work on your side.

 

However, I think we could discuss about why it does not work from the beginning. I think it is a cache issue.

 

  • Power BI might not be refreshing its internal state or metadata when you modify the DataTable() function. This can cause it to retain the old logic even after you remove them.

  • Power BI enforces a constraint that a column used for sorting must have a one-to-one relationship with the column being sorted. When duplicates are present, this constraint is violated, and the error occurs.

  • Saving, closing, and reopening the report likely forces Power BI to rebuild its internal cache or metadata, which resolves the issue.

If you don't want to update the version, I suggest you use a calculated table instead, which is more reliable.

vqiaqimsftv_1-1738647960469.png

Table2 = 
UNION(
    ROW("Name", "X", "Ord", 1),
    ROW("Name", "Y", "Ord", 2),
    ROW("Name", "X", "Ord", 3)
)

 

Best Regards,
Qi
Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

 

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @Anonymous,

Thanks for the reply from @lbendlin, I could not roll back to an earlier version to reproduce your issue, try to update to a new version like lbendlin mentioned and check if it could work on your side.

 

However, I think we could discuss about why it does not work from the beginning. I think it is a cache issue.

 

  • Power BI might not be refreshing its internal state or metadata when you modify the DataTable() function. This can cause it to retain the old logic even after you remove them.

  • Power BI enforces a constraint that a column used for sorting must have a one-to-one relationship with the column being sorted. When duplicates are present, this constraint is violated, and the error occurs.

  • Saving, closing, and reopening the report likely forces Power BI to rebuild its internal cache or metadata, which resolves the issue.

If you don't want to update the version, I suggest you use a calculated table instead, which is more reliable.

vqiaqimsftv_1-1738647960469.png

Table2 = 
UNION(
    ROW("Name", "X", "Ord", 1),
    ROW("Name", "Y", "Ord", 2),
    ROW("Name", "X", "Ord", 3)
)

 

Best Regards,
Qi
Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

 

lbendlin
Super User
Super User

There was a bug in version 2.139.1733.0 - use a different version.  Your example works fine with 2.139.2054.0 , for example

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors
Top Kudoed Authors