Forum Discussion
Power BI
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.02. 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 RelationshipPower BI Month Names Fix