Forum Discussion

abhishek_300's avatar
abhishek_300
Frequent Visitor
9 years ago
Solved

Month not getting sorted Correctly

Hi ,

 

When I am creating a dasboard based on Month and Sales. The Sales are not getting sorted correctly by Month.

The month are appearing like below.

January -2016

January -2017

February-2016

March-2016

April-2016.

 

How to fix this so that the January month 2017 appers after the December month 2016.

I am connecting to the tabular model which has this data and I am using Power BI Pro.

 

Please advise.

10 Replies

  • Hi abhishek_300,

     

    You need one OrderColumn in your tabular model with value = Year*100 + MonthNo (201607, 201608, ..) so you could sort column Month Year by that order column in Power BI.

    Are you using Import mode or direct query? Cause using import mode, you could create order column by adding Condition Column in Power BI, but with Direct Query, you need create order column in server side of tabular model

    • abhishek_300's avatar
      abhishek_300
      Frequent Visitor

      hI,

       

      Thanks for your reply.I am using direct query and I am creating dataset directly from the Power BI Pro. I am not using Power BI desktop.

      So do I need to create an Order column on tabular model using below query

      OrderColumn = Year*100+Month_Number.

      So that will be 2017*100+1= 201701.

      So does that mean I will have to show to the users 201701 and I cannot use the column with the value like January-2017 in the visual.

      • tringuyenminh92's avatar
        tringuyenminh92
        Memorable Member

        Hi abhishek_300,

         

        You show January-2017 column but sort by order column, you need to do it in Power BI Desktop and publish pbix file.