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
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

Hi @amitchandak 

 

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

 

Cado

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.