Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
anilbatra
New Member

How to fix the data sort issue with month names

I have my data in excel with month name in one of the columns.  When I create a chart and sort by month, it sorts december before January since it bring the data as text.  How can I fix this issue?  I tried to convert the data into date type in Power BI but it gives me an error that that data can not be changed. 

3 ACCEPTED SOLUTIONS
GilbertQ
Super User
Super User

Hi @anilbatra,

 

I would suggest going into the Query Editor and creating a Conditional Column.

 

For your Conditional Column you would create it where for each Month you would give it a number.


As shown below:

 

Power BI - Conditional Column - Month.png

And then once this loads into Excel or Power BI Desktop, click on the Modelling tab, and where it says Sort by Column, click on the Drop Down and select the Month Number column you created above.

 

Power BI - Sort By Column.png

After which your months should then sort correctly.

 

 





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

Proud to be a Super User!







Power BI Blog

View solution in original post

You have to select the field on the fields list, not in the visuals pane.

View solution in original post

Hi @anilbatra,

 

You need to selected your month name filed in your Fields.
Untitled.png

 

Regards,

Charlie Liao

View solution in original post

6 REPLIES 6
GilbertQ
Super User
Super User

Hi @anilbatra,

 

I would suggest going into the Query Editor and creating a Conditional Column.

 

For your Conditional Column you would create it where for each Month you would give it a number.


As shown below:

 

Power BI - Conditional Column - Month.png

And then once this loads into Excel or Power BI Desktop, click on the Modelling tab, and where it says Sort by Column, click on the Drop Down and select the Month Number column you created above.

 

Power BI - Sort By Column.png

After which your months should then sort correctly.

 

 





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

Proud to be a Super User!







Power BI Blog

@GilbertQ,

 

I created the conditional column as you instructed. I went to the modeling tab to do my sort and the "sort by column" button is greyed out. Any suggestions?

 

BISort.JPG

Hi @naperryman,

 

What you will need to do is to select the Month column so that it is shown as selected with the yellow bar around it as shown below.

 

Power BI - Month Selected.png

 

Once you have selected the above, the Sort By Column should then be able to be changed.





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

Proud to be a Super User!







Power BI Blog

The chart, a bar graph, does not let me sort it by this conditional column.  The only options available are the month name (used in x-axis) and various values I used in chart.  The top menu option "Sort by Column" is grayed out.

Hi @anilbatra,

 

You need to selected your month name filed in your Fields.
Untitled.png

 

Regards,

Charlie Liao

You have to select the field on the fields list, not in the visuals pane.

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.