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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

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
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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