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
Anonymous
Not applicable

Adjusting the Date Axis on a Line Chart

Hopefully a fairly simple question. For a project I am working on, I need to create a line chart with months being the x-axis, but I need it to start with October and run through Septmber to represent our businesse's fiscal year. How can this be done?

1 ACCEPTED SOLUTION
sturlaws
Resident Rockstar
Resident Rockstar

It is a simple solution for this. In the modelling ribbon of PBI Desktop, there is a "Sort by column"-button. Say you have date table, and in that table you have a column with the month name, e.g. January, February,...

 

The only thing you might be missing is how the months should be ordered. You could use the "Enter data"-functionality found in the home ribbon of PBI Desktop to type in month name and the order of the month. Then from your date table create a new column which is a lookup to this manually entered table to get the month sorting. Select you month name column in the date table and sort it by the new column in the date table.

 

Or you can use a little dax like this in your date table:

MonthNumberFiscal =
IF (
    MONTH ( vDate[Date] ) < 10;
    DATEDIFF (
        DATE ( YEAR ( vDate[Date] ) - 1; 10; 1 );
        STARTOFMONTH ( vDate[Date] );
        MONTH
    );
    DATEDIFF (
        DATE ( YEAR ( vDate[Date] ); 10; 1 );
        STARTOFMONTH ( vDate[Date] );
        MONTH
    )
) + 1


her as an example: report

View solution in original post

4 REPLIES 4
v-lili6-msft
Community Support
Community Support

hi, @Anonymous 

You could use Sort By column in power bi to get it.

Use your fiscal [year-month] column as the "By column", If there is no [year-month] column in the table, just add it manually.

https://radacad.com/sort-by-column-in-power-bi

 

Best Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
sturlaws
Resident Rockstar
Resident Rockstar

It is a simple solution for this. In the modelling ribbon of PBI Desktop, there is a "Sort by column"-button. Say you have date table, and in that table you have a column with the month name, e.g. January, February,...

 

The only thing you might be missing is how the months should be ordered. You could use the "Enter data"-functionality found in the home ribbon of PBI Desktop to type in month name and the order of the month. Then from your date table create a new column which is a lookup to this manually entered table to get the month sorting. Select you month name column in the date table and sort it by the new column in the date table.

 

Or you can use a little dax like this in your date table:

MonthNumberFiscal =
IF (
    MONTH ( vDate[Date] ) < 10;
    DATEDIFF (
        DATE ( YEAR ( vDate[Date] ) - 1; 10; 1 );
        STARTOFMONTH ( vDate[Date] );
        MONTH
    );
    DATEDIFF (
        DATE ( YEAR ( vDate[Date] ); 10; 1 );
        STARTOFMONTH ( vDate[Date] );
        MONTH
    )
) + 1


her as an example: report

Anonymous
Not applicable

@sturlaws  Can you give me an example of how to create the lookup column? 

here is one example: example

 

but excatly how to do it will depend on your data and desired output. Do you have data for more than one fiscal year? Should your slicers have values like 2017/2018, 2018/2019, ...? Should the labels be Oct, Nov,....,Sep or should they be Oct-18, Nov-18,..,Jan-19,...Sep-19?

 

There is one small issue to be aware of. The column you use for the lookup can not be sorted by the column resulting from the lookup.

 

br,

S

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.