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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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