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, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now

Reply
Cado_one
Resolver III
Resolver III

Sort column with repeated values by another column

Hi,

 

I got an issue with a frequent columns sorting error and none of the similar existing topics has been able to solve the problem.

Here comes some explanation :

I have a column which contains many values between 0 and 1. I want to sort this column by an other one who contains integers 0,1,2,3,4,5,6. The problem is that each one of them has repeated values and  the sorting by returns the error "We can't sort the 'Plan achievement' column by 'AreaColorIndex'. There can't be more than one value in 'AreaColorIndex' for the same value in 'PlanAchievement'. Please choose a different column for sorting or update the data in 'AreaColorIndex'.

Please find above a sample looking like my datas :

PlanAchievementAreaColorIndex

0

0
00
0.250
0.130
03
0.993
03
01
0.51

 

How can I get around this issue ?

I'll be glad to read and try any of your ideas !

Thanks in advance,

Cado

 

1 ACCEPTED SOLUTION
v-zhenbw-msft
Community Support
Community Support

Hi @Cado_one ,

 

The PlanAchievement column has multiple values. For example, in your sample, the column has five 0. So it cannot sort by other column.

You need to add an index column and create a new PlanAchievement column to replace it.

Please refer the following steps.

 

1. Add an index column using Power Query Editor.

 

sort1.jpg

 

2. Then we can create a column. Create a table visual using this column and sort by AreaColorIndex column.

 

New plan Achievement Column = 'Table'[PlanAchievement] + 'Table'[Index] * 0.00000001

 

sort2.jpg

 

sort3.jpg

 

If it doesn’t meet your requirement, could you please show the exact expected result based on the table that you have shared?

 

Best regards,

 

Community Support Team _ zhenbw

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

 

BTW, pbix as attached.

View solution in original post

5 REPLIES 5
v-zhenbw-msft
Community Support
Community Support

Hi @Cado_one ,

 

The PlanAchievement column has multiple values. For example, in your sample, the column has five 0. So it cannot sort by other column.

You need to add an index column and create a new PlanAchievement column to replace it.

Please refer the following steps.

 

1. Add an index column using Power Query Editor.

 

sort1.jpg

 

2. Then we can create a column. Create a table visual using this column and sort by AreaColorIndex column.

 

New plan Achievement Column = 'Table'[PlanAchievement] + 'Table'[Index] * 0.00000001

 

sort2.jpg

 

sort3.jpg

 

If it doesn’t meet your requirement, could you please show the exact expected result based on the table that you have shared?

 

Best regards,

 

Community Support Team _ zhenbw

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

 

BTW, pbix as attached.

Hi @v-zhenbw-msft ,

 

I come back to you because my need has changed a little. I'm now using some external and calculated tables that are merged (UNION function) with the table where the plan achievement is calculated.

In response, I have to calculate the index column in DAX directly to merged table and it gives me difficulties.

I tried the RANKX function but it doesn't work because I have no column with unic values in the table.

Do you have an idea of how to create this index column in DAX ?

 

Thanks in advance,

Cado

Hi @v-zhenbw-msft 

 

You're solution is tricky but works perfectly as expected. Thank you very much !

I think this will be helpful to other users from the community

 

Have a nice day,

Cado

amitchandak
Super User
Super User

@Cado_one , Sort column need to have the same granularity as sort column

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Hi @amitchandak 

 

What do you mean by "granularity" ? I'm sorry my english is quiet limited.

 

Cado

Helpful resources

Announcements
OCT PBI Update Carousel

Power BI Monthly Update - October 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

October NL Carousel

Fabric Community Update - October 2024

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