Forum Discussion

Connor888's avatar
Connor888
Frequent Visitor
2 years ago
Solved

Sort by error, duplicate values where there appear to be none

Hi,

I'm trying to get one column to sort by another, and I'm getting the error that there are multiple sort-by values for each of the to-sort column's values:


However when I summarize the two columns to try and spot where the error is, it looks like everything is correct:

Is there something I'm missing, or is summarize not giving me the full picture?

Thanks!



  • As it happens I fixed things. Looks like it was just a Power BI bug - restarting has removed the error. Thanks for your help anyway!

4 Replies

  • Please follow the steps below to have it work. Adjust it accordingly. 

    Step 1

     Create a Custom Table with all the category either manually in Power Query or Summarize Table.

    Create a new column beside and provide the number in the order you want to arrange.

     

    Step 2

    Create a relationship between the column in actual table to the custom sort table

    Step 3

    Create a column in Actual table with an expression.

    Sort order = RELATED(CustomSortTable[Sort])

     

    Step 4

    Select the column you want to sort, and a “Column Tools” menu bar will appear at the top. Now Select the “Sort by column” and select the sort order column.

    • Connor888's avatar
      Connor888
      Frequent Visitor

      Hi Kaviraj,

       

      That is the setup I have, the field [BucketSort] in the image above is pulled in from another table with RELATED. I also tried using SWITCH within the calculated column, which also didn't work.

      • Kaviraj11's avatar
        Kaviraj11
        Icon for Solution Sage rankSolution Sage

        Would you able to share the pbix file or a sample file?