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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Thomas_MedOne
Helper III
Helper III

Yet another Sort by another Column error.

I've done research but so many issues out there that are not the same. This is my last resort...

 

I have a column: Day of Week and I have a column that I built in Power Query for the sorting. (Conditional column to output a number) The values are here:

Day of WeekDayNum
Monday1
Tuesday2
Wednesday3
Thursday4
Friday5
Saturday6
Sunday7
HolidayPay8
SuperHolidayPay9

 

After creating the column in Powerquery and applying. I go to the Day of Week and I choose to sort by DayNum and I get the complaint that there are multiple values in one column for the same column. So..

 

I went through the long process of filtering only by Monday (then Tuesday, etc) for Day of Week and checking DayNum to see that the values are unique. Then I did the same filtering on DayNum and those values are unique.

 

So, both are unique for each type and number!  Why won't it sort?!  Is it a caching issue because I once had it duplicated but now I don't?

1 ACCEPTED SOLUTION

I had to refresh the data and then quit Power BI Desktop and reload it up again and then it allowed me. It must have been a caching issue.

View solution in original post

10 REPLIES 10
Ritaf1983
Super User
Super User

Hi @Thomas_MedOne 

The issue seems to be that the sorting you're performing is somehow conflicting with the order of the days. On the unique values table, everything works fine (see the attached image).

Ritaf1983_0-1714755342343.png

Ritaf1983_1-1714755384405.png

 

Therefore, what you need to do is sort your small table and link it to the large table using a one-to-many relationship. In the visualizations, you'll use the days from the small table. This will work.

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly

 

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

My table itself of course has lots of other columns and there are lots of Mondays and Tuesdays, etc. and the "DayNum" column is in the same table. So I don't have a small table at all.  I guess I could add one but it seems overkill just to sort one column.

Hi @Thomas_MedOne 

Small table with 9 rows is very far from overkilling. It will solve the issue , and this is how pbi's engine like to work 🤓

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

No, but just creating a table to sort another table, that just seems unnecessary. perhaps in some instances it is not. The solution, ultimately, was to refresh the data, quit Power BI Desktop and load it back up again and it allowed me to sort. It must have been a caching issue from a previous attempt when I didn't have unique values.

Thanks for looking into it and even teaching something that I didn't know was a thing. I am pretty new at all this.

Restarting PBI worked for me too. I had created the Sort with the wrong FORMAT setting but when I changed it, I was still getting the error. 

 

Exiting out of PBI and reloading resolved the error and am it is now sorting on the new column. 

Happy to hear that the issue is solved.

You can accept your answer as solution.

According to small table and efficiency , note that the small table for sorting is only 18 cells.

When you adding to your table a column for sorting the number of cells is the same of the big table... 

 

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile
sjoerdvn
Super User
Super User

Hard to tell. Execute a data refresh before setting the sort. Also, check for blanks or empty strings.

I had to refresh the data and then quit Power BI Desktop and reload it up again and then it allowed me. It must have been a caching issue.

After scratching my head for an uncomfortably long time, exporting to excel and checking values, and creating a new calculated table with SUMMARIZE() and verifying the uniqueness of my values, I almost lost hope. Indeed, my similar issue was with caching. Closing and reopening PBI got rid of the error. I assume this occurs when you have duplicates, fix the duplicates w/ a refresh, and try to sort again.

The error message is completely unhelpful in this situation. Please improve it Microsoft!

THANK YOU!!!!  I was about to lose it.  Quitting Power BI and restarting fixed the issue.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

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