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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
RichOB
Helper V
Helper V

Need help updating graph sort order

Hi, I want my graph to be the UK financial year April24 - March25.

 

I've made a column called Month_Number that says April = 1, May = 2, etc.

I then changed the sort order of the Month_Name to Month_Number and used Month_Name in my X-Axis.

But it's still giving me this order, I need January to be placed after December please:

 

JanGraph.png
Thanks for your help

1 ACCEPTED SOLUTION
v-zhengdxu-msft
Community Support
Community Support

Hi @RichOB 

 

Please try this:

Here I create a set of sample:

Table with data from 2024,1,1 to 2025,12,1:

vzhengdxumsft_0-1738724224863.png

Then add a calculated table:

Table 2 = 
SUMMARIZE (
    SELECTCOLUMNS (
        'Table',
        "Month_name", FORMAT ( 'Table'[Date], "MMM" ),
        "Month_number",
            VAR _month =
                MONTH ( 'Table'[Date] ) - 3
            RETURN
                IF ( _month <= 0, _month + 12, _month )
    ),
    [Month_name],
    [Month_number]
)

vzhengdxumsft_1-1738724309047.png

Select the [Month_name] and click sort by [Month_number]:

vzhengdxumsft_3-1738724401485.png

 

Connect the Table and Table 2 with the field Month_name:

vzhengdxumsft_2-1738724349904.png

The result is as follow:

vzhengdxumsft_4-1738724423889.png

 

.PBIX file has attached.

 

Best Regards

Zhengdong Xu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-zhengdxu-msft
Community Support
Community Support

Hi @RichOB 

 

Please try this:

Here I create a set of sample:

Table with data from 2024,1,1 to 2025,12,1:

vzhengdxumsft_0-1738724224863.png

Then add a calculated table:

Table 2 = 
SUMMARIZE (
    SELECTCOLUMNS (
        'Table',
        "Month_name", FORMAT ( 'Table'[Date], "MMM" ),
        "Month_number",
            VAR _month =
                MONTH ( 'Table'[Date] ) - 3
            RETURN
                IF ( _month <= 0, _month + 12, _month )
    ),
    [Month_name],
    [Month_number]
)

vzhengdxumsft_1-1738724309047.png

Select the [Month_name] and click sort by [Month_number]:

vzhengdxumsft_3-1738724401485.png

 

Connect the Table and Table 2 with the field Month_name:

vzhengdxumsft_2-1738724349904.png

The result is as follow:

vzhengdxumsft_4-1738724423889.png

 

.PBIX file has attached.

 

Best Regards

Zhengdong Xu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

RichOB
Helper V
Helper V

HI @bhanu_gautam thanks for your reply. 

 

Your solution makes sense and I followed the steps, but when I'm sorting the Month_Name column by Month Number, I'm getting an Error message saying A Circular Dependency Was Detected and it's not sorting the column. Any ideas how to fix this please?

bhanu_gautam
Super User
Super User

@RichOB , Try using

Ensure that your Month_Number column correctly reflects the custom order where April is 1 and March is 12. You can create this column in Power BI using DAX.

DAX
Month_Number = SWITCH(
TRUE(),
'Table'[Month_Name] = "April", 1,
'Table'[Month_Name] = "May", 2,
'Table'[Month_Name] = "June", 3,
'Table'[Month_Name] = "July", 4,
'Table'[Month_Name] = "August", 5,
'Table'[Month_Name] = "September", 6,
'Table'[Month_Name] = "October", 7,
'Table'[Month_Name] = "November", 8,
'Table'[Month_Name] = "December", 9,
'Table'[Month_Name] = "January", 10,
'Table'[Month_Name] = "February", 11,
'Table'[Month_Name] = "March", 12
)

 

In Power BI, you need to sort the Month_Name column by the Month_Number column. 

Go to the Data view.
Select the Month_Name column.
In the ribbon, click on the "Sort by Column" button.
Choose Month_Number from the dropdown list.

 

Now, when you use Month_Name in your X-Axis, it should follow the custom order defined by Month_Number.

 




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






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! Prices go up Feb. 11th.

Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Jan NL Carousel

Fabric Community Update - January 2025

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