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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
aschrock
New Member

How to make x-axis in date order rather than based on value

Powerbi help.PNG

I need help to correct my x-axis from being based on line value rather than in date order. How do I change? 

 

 

1 ACCEPTED SOLUTION
MattAllington
Community Champion
Community Champion

In the ellipsis in the top right corner of the chart you should be able to select the sort order. The issue may be that your x axis is not a date, but a surrogate date. 



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
I will not give you bad advice, even if you unknowingly ask for it.

View solution in original post

6 REPLIES 6
MattAllington
Community Champion
Community Champion

In the ellipsis in the top right corner of the chart you should be able to select the sort order. The issue may be that your x axis is not a date, but a surrogate date. 



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
I will not give you bad advice, even if you unknowingly ask for it.

Hi,

 

someone please help me to sort my x axis which has the values like

Jan 2018, Feb 2018, Mar 2018, Jan 2017, Feb 2017, Mar 2017, Jan 2019, Feb 2019, Mar 2019

 

I want the values to be sorted with the same format.

 

Current sorting:

Jan 2017 Jan 2018 Jan 2019 Feb 2017 Feb 2018 Feb 2019

 

Expected Sorting: 

Jan 2017 Feb 2017 Mar 2017 Jan 2018 Feb  2018 Mar 2018 Jan 2019 Feb 2019 Mar 2019

 

FYI, currently I am having a calculated sorting field to get this done, but it is not working.. 

MonthSort = FORMAT(InforcePolicy[POLICY_EFFECTIVE_DATE],"YYYYmm")

 

from the ellipsis, I have choosed Sort by "CalendarMonth" (Ascending).. 

 

any input is much appreciated. 

 

Data Table & columns in it.

abcabc

 

The chart in the report looks like the below.

Inforce_IncorrectSorting_PBI.JPG

A better way I have found to do this is go back to the date before you formatted it and make it your axis. Delete Quarter and Day off your date hierachy. 

 

 Then on the graphic is a couple arrows in the top corner, hit the fourth one over and click month! Then you can sort by date with these buckets intact!

It looks like this column you are sorting on is Text.  If you want it to sort in date order, you need to convert the column to a date fromat.



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
I will not give you bad advice, even if you unknowingly ask for it.

Hi @MattAllington

 

Thanks for your kind suggestion, Actually, I have got it done in the way I know.. (may be it is stupid.. )

 

from the Power Query window, I selected the "Calendar Month" column and make the column to get sorted by the "MonthSort" column. 

 

This approach worked for me.. just to share this, who knows, this may help someone else.. 

 

Once again, thans for your time and reply.. 

Hi, I am not able to set the order of sorting. The menu offers only Z-A sorting, but not the A-Z.

I am using the index (of the week) to create a column chart.
Please advise if it is possible to use custom values of axis for custom sorting

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.