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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
Thomas_MedOne
Helper II
Helper II

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

8 REPLIES 8
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.

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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