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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
kgriendling
Advocate I
Advocate I

Sort by Column - Error Message

Hi!

 

I have two columns, One is an index that I am trying to sort by. The other is calculated values.

 

Looks like this:

 

Column A:

  • 1
  • 2
  • 3
  • 4
  • 5

Colum B:

  • 0
  • 0
  • 32250.5426
  • 22741.2256
  • 31300.2555

I get the Sort by another column error that says We can't sort Column B by Column A. There can't be more than one value in Column A for the same Value in Column B.

 

Why would this be an issue? It is a straight list of numbers that increase by 1 each row?

6 REPLIES 6
KHorseman
Community Champion
Community Champion

0 appears twice in the second column. You can't sort that with 2 different numbers. Should 0 be the first thing in a list or the second? It would be impossible to tell if it's supposed to be sorted as both 1 and 2.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




I think I had the system backwards. I was thinking by selecting Column B I was sorting column B by the order of Column A.

 

I tried selecting Column A and sorting it by Column A and that didn't work.

 

I got it to work by sorting a category column instead. It was organizing the category titles alphabetically. >.<

It doesn't matter which order you select the columns in. There are repeat values in one column and different values in the other. If you're trying to impose a sort order the unique values must match. If I want to make the alphabet sort in reverse order I need this setup:

 

ValueSortOrder
A26
B25
C24
D23
E22
F21

 

What you have is the equivalent of this:

 

ValueSortOrder
A26
B26
C25
D24
E23
F22

 

Which should come first, A or B? It's impossible to tell from this. That's why you're getting that error.

 

The reverse would also be incorrect.

 

ValueSortOrder
A26
A25
B24
C23
D22
E21

 

Should A be number 26 or 25? Impossible.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




What was happening was that I was getting:

 

  • A
  • C
  • D
  • B
  • E

and 

  • 26
  • 24
  • 23
  • 25
  • 22

Because I had some other column with alphabetical categories that for some reason took precedence in the sort order.

  • Apples
  • Beets
  • Cucumbers
  • Dates
  • Eggplants

The issue I was having was that I selected the numerical column and said "Sort by Index A" which was my ACDBE column. Thinking that it would work like excel and give me an alphabetically organized index in the column I selected.

 

What I needed to do was select the dominant column - the fruits and veggies for instance, and sort THAT by the index values instead.

The goal (and result) was to have a list in the order of:

  • Apples
  • Cucumbers
  • Dates
  • Beets
  • Eggplants

@kgriendling

 

I haven't encountered your error.

 

Capture.PNG

 

Can you share some sample data or .pbix?

 

Regards,

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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