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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
sailochanar
Helper II
Helper II

Power BI

Hey Mates ....

I have been trying to build a report where I'm stucked with a issue like month names are not in order ,even after sorting and tried many ways to sort ,by transforming data,adding new col,slicing blah blah ...still didnt yet solved.

Kindly suggest the solution.

sailochanar_0-1679980466767.png

 Observe tht image where in X-axis month names are not in order .Thats the Issue ,I'm facing.

 

Thanks ..!

8 REPLIES 8
Olufemi7
Resolver I
Resolver I

Hi @sailochanar,

The month names are sorting alphabetically because Power BI is treating them as text (like “Jan23”, “Feb23”).
You need to give Power BI a real date to sort by.

Try this simple fix:

1. 

MonthText    BuyerSellerRatio
Dec22        2.0
Jan23        2.3
Feb23        2.5
Mar23        1.8
Apr23        1.0

2. Add a real date column

 

MonthStartDate =
DATE(
    2000 + RIGHT('Table1'[MonthText], 2),
    SWITCH(
        LEFT('Table1'[MonthText], 3),
        "Jan",1,"Feb",2,"Mar",3,"Apr",4,"May",5,"Jun",6,
        "Jul",7,"Aug",8,"Sep",9,"Oct",10,"Nov",11,"Dec",12
    ),
    1
)

 

3. Create a Date table

 

DateTable =
ADDCOLUMNS(
    CALENDAR(MIN('Table1'[MonthStartDate]), MAX('Table1'[MonthStartDate])),
    "MonthYear", FORMAT([Date], "mmm yyyy"),
    "MonthNum", MONTH([Date]),
    "YearNum", YEAR([Date]),
    "SortOrder", YEAR([Date]) * 100 + MONTH([Date])
)

 

4. Build the relationship
Link Table1[MonthStartDate] → DateTable[Date]
(Many-to-one, single direction)

5. Sort your MonthYear column
In the DateTable, sort MonthYear by SortOrder.


6. Test with two charts

  • Chart 1 (Before fix)
    X-axis → Table1[MonthText]
    Y-axis → Table1[BuyerSellerRatio]
    → Months show alphabetically (wrong).

  • Chart 2 (After fix)
    X-axis → DateTable[MonthYear]
    Y-axis → Table1[BuyerSellerRatio]
    → Months show correctly: Dec22 → Jan23 → Feb23 → Mar23 → Apr23.

This approach works in both Power BI Desktop and Power BI Service.Manage RelationshipManage RelationshipPower BI Month Names FixPower BI Month Names Fix



Anonymous
Not applicable

Hi @sailochanar ,

By using switch function u can create new column and add these new field  to the existing filed then apply sorting then it will return.

FYR- 

SWITCH(financials[Month Name],"April","04-April","June","06-june")

Thanks & Regards,

Madhan Reddy

 

Ray_Minds
Continued Contributor
Continued Contributor

You can follow below steps:
1)you can add a new column in Power Query Editor or using DAX to represent the monthnumber..
MonthNumber =
SWITCH(
[Month],
"Jan'23", 1,
"Feb'23", 2,
"Mar'23", 3,
"Apr'23", 4,
"May'23", 5,
"Jun'23", 6,
"Jul'23", 7,
"Aug'23", 8,
"Sep'23", 9,
"Oct'23", 10,
"Nov'23", 11,
"Dec'23", 12,
BLANK()
)

  • Sort the data by the MonthNumber column.
Anonymous
Not applicable

Create a column format in Year-Month (format(your date column),"YYYY-MMM") , like 2024-07 and sort by ascending order.
Or create another column (let sy column A) with your desired order, then sort your original column by column A.

sailochanar
Helper II
Helper II

I splitted the month column which is filled with Jan'23,Feb'23....so on ,and added another column with Month_number and merged all three. still even after sorting with mnth number also it is not getting sorted . Please suggest a simple way if possible.

JorgePinho
Solution Sage
Solution Sage

Hello @sailochanar! Do you have a calendar table? If so my suggestion would be to have a numeric column of month year where, for example, dec23 would be 1223 and june23 0623. Then you can order the original column based on the numeric one.

Nope I just have month attribute ,Yeah I even created that as u said for Dec23-1223..But still the order is not sorted.(Splitting column ,conditions...) still not solved.

Can you explain how you sorted using that column that I suggested? Or maybe share the report

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors