Forum Discussion

Cado_one's avatar
Cado_one
Resolver III
5 years ago
Solved

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

 

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

     

     

    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

     

     

     

    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.

5 Replies

  • v-zhenbw-msft's avatar
    v-zhenbw-msft
    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.

     

     

    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

     

     

     

    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.

    • Cado_one's avatar
      Cado_one
      Resolver III

      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

    • Cado_one's avatar
      Cado_one
      Resolver III

      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

    • Cado_one's avatar
      Cado_one
      Resolver III

      Hi amitchandak 

       

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

       

      Cado