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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
jprheeder
Frequent Visitor

change graph X-axis order to fiscal year

Hiya,

I've been struggling to get my line graph to order it's x-axis by our fiscal start date (July) rather than calendar month. 

 

I've followed some answers on this topic for similar questions, to varying degrees of success, ie(https://community.powerbi.com/t5/Desktop/change-graph-X-axis-order-to-fiscal-year/m-p/367746)

as posted in the above link, I have created a conditional column that sets a number based on what the start date should be for a July Start:

= Table.AddColumn(#"Added Custom", "MonthNumber", each if [Month] = 1 then 7 else if [Month] = 2 then 8 else if [Month] = 3 then 9 else if [Month] = 4 then 10 else if [Month] = 5 then 11 else if [Month] = 6 then 12 else if [Month] = 7 then 1 else if [Month] = 8 then 2 else if [Month] = 9 then 3 else if [Month] = 10 then 4 else if [Month] = 11 then 5 else if [Month] = 12 then 6 else null)

Modeling Tab appears to be correct, in that July(7) has been conditionally mapped to MonthNumber(1):

jprheeder_1-1675309855787.png


I then flick back to the main Field and on the Date Column, I select the "Sort by column" and sort by MonthNumber

jprheeder_2-1675310043910.png

That appears to correctly order the Table, but not the Line graph:

jprheeder_0-1675309760306.png


The amounts for January correspond to the relative Fiscal year (ie the following year) but wont show up where they should.

I've tried sorting by Column in both the Modeling tab via selecting the field. 

If I substitute the (Month) Date Hierarchy in the X-Axis with the MonthNumber Field, I get what I'm looking for, but obviously with the drawback of having numbers where the Month Name should be:

jprheeder_3-1675310376020.png

 

Please, teach me Senpai.


1 ACCEPTED SOLUTION
johnyip
Super User
Super User

I think you can create another conditional column in PowerQuery to extract the month name, and then sort that conditional column with "MonthNumber".

 

Finally, use that conditional column in your line chart.



Please mark my post as the solution if this answers your question!
Appreciate your Kudos !!

View solution in original post

2 REPLIES 2
johnyip
Super User
Super User

I think you can create another conditional column in PowerQuery to extract the month name, and then sort that conditional column with "MonthNumber".

 

Finally, use that conditional column in your line chart.



Please mark my post as the solution if this answers your question!
Appreciate your Kudos !!

Thanks @johnyip That worked. Looks like it wouldn't sort the Date field, but was happy to sort a text field of the extracted month.

 

👌

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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