Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Sort Issue

Hi, 
I am trying to sort a filter that has text. I want to sort it ascending wise. 
I have assigned a new column number and gave each value a number. But I still can't sort it 


the code:

Number = SWITCH (
TRUE (),
'Won_count'[WonOppsSoftAmountLast1Yr_filter] = "under $25k", 1,
'Won_count'[WonOppsSoftAmountLast1Yr_filter] = "$25Kto$50K", 2,
'Won_count'[WonOppsSoftAmountLast1Yr_filter] = "50Kto$100K", 3,
'Won_count'[WonOppsSoftAmountLast1Yr_filter] = "$100Kto500K", 4,
'Won_count'[WonOppsSoftAmountLast1Yr_filter] = "$500Kto1Million", 5,
'Won_count'[WonOppsSoftAmountLast1Yr_filter] = "$1 Million and Over", 6,
10
)

  • Hi Anonymous ,

     

    We suggest you to create a new Won_count table with unique values. And then create a one-to-many relationship with the original table.

    You can refer the following steps.

     

    1. Create a new table.

     

    Table = DISTINCT(Won_count)

     

     

    2. Then create the relationship.

     

     

    3. Create a slicer using Table[WonOppsSoftAmountLast1Yr_filter] and sort by number.

     

     

    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.

11 Replies

  • v-zhenbw-msft's avatar
    v-zhenbw-msft
    Community Support

    Hi Anonymous ,

     

    We suggest you to create a new Won_count table with unique values. And then create a one-to-many relationship with the original table.

    You can refer the following steps.

     

    1. Create a new table.

     

    Table = DISTINCT(Won_count)

     

     

    2. Then create the relationship.

     

     

    3. Create a slicer using Table[WonOppsSoftAmountLast1Yr_filter] and sort by number.

     

     

    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.

  • Anonymous did you used sort by to sort your text column

     

    I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!

    Visit us at https://perytus.com, your one-stop shop for Power BI related projects/training/consultancy.

    • Anonymous's avatar
      Anonymous
      Not applicable

      parry2k 
      yes, but that remains un-highlighted I cannot select it

      • Anonymous's avatar
        Anonymous
        Not applicable

        parry2k 
        do I need to add the column "number" (where I have assigned all the numbers based on sorting ) in any of these 
        fields.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

     

     

    In the Data View.

     

    Select the Column Software Amount Last Type,  click on Sort By Column and Sort it by Number

     

     

     

    Regards,

    Harsh Nathani


    Appreciate with a Kudos!! (Click the Thumbs Up Button)

    Did I answer your question? Mark my post as a solution!

    • Anonymous's avatar
      Anonymous
      Not applicable

      Anonymous ,
      the column software amt last is already sort by itself. If I try to change the sorting from Sort by Column, I get below error: