Forum Discussion

Dave1982's avatar
Dave1982
Frequent Visitor
5 years ago
Solved

Sort by Column Not Working for Month Number in Slicer

I have a data set that I have imported into Power BI that has an Outreach date column, Month, and Month Number column.  Date column is formatted as a date, Month is formated as text, and Month Number is formatted as Whole Number. I want to add a slicer that shows the Month is numerical order versus alphabtical order. I have used the sort by column on the outreach date and selected the Month Number column as this has worked for me in the past. For some reason it does not work in this scenerio. 

I want to be able to have the above show as April, May, June, etc instead if April, June, and May.

I have a similiar data set that works with no issues be sorting the column by outreach date and month number.

I am not getting an error when I am doing the sort, but it is not working when I either add a slicer or any visualizations.

 

 

Any help is much appreciated.

 

  • Dave1982 that measure you month number value for the same month is not consistent.

     

    For example, in some rows for the month of April, the month number is 3 or 4 or another value, basically, each month should have the same month number value. Check your data. Seems like there is inconsistency in your data. 

     

    Check my latest blog post Comparing Selected Client With Other Top N Clients | PeryTUS  I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to 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.

6 Replies

  • Dave1982 that measure you month number value for the same month is not consistent.

     

    For example, in some rows for the month of April, the month number is 3 or 4 or another value, basically, each month should have the same month number value. Check your data. Seems like there is inconsistency in your data. 

     

    Check my latest blog post Comparing Selected Client With Other Top N Clients | PeryTUS  I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to 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.

  • Dave1982 , based on what I got. I think you need to make sure that month no is sort column for Month(Text) .

  • Burningsuit's avatar
    Burningsuit
    Icon for Resident Rockstar rankResident Rockstar

    Hi Dave,

    In the grid view, you need to select the Month column and then click "Sort by column" (In the "Column Tools" tab). From the drop down there select the Month Number column. Actually sorting the column as you have done does not make any difference, you need to use the "Sort by Column" to make those Months sort correctly.

     

    Hope this helps

     

    Stuart

     

  • Dave1982 based on your original post, the following doesn't make sense. Why you are sorting the date column by Month Number, as suggested by others, you need to sort Month column by Month Number not Outreach Date column by Month Number.

     

     I have used the sort by column on the outreach date and selected the Month Number column

     

    Check my latest blog post Comparing Selected Client With Other Top N Clients | PeryTUS  I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to 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.

     

    • Dave1982's avatar
      Dave1982
      Frequent Visitor

      parry2k The reason is that when I sort by Month and Month Number I get an error that is returned to me.

       
       

       

       

       

      • Burningsuit's avatar
        Burningsuit
        Icon for Resident Rockstar rankResident Rockstar

        Yes, your "Month Number" column is incorrect, with different values for a single month. How are you getting that column ? Probably the simplest way is to generate a calculated column like..

        Month Number = month(TableName[Outreach Date])

         

        Stuart