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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
UncleLewis
Responsive Resident
Responsive Resident

Sort Calculated Column In Date Table

Hi,

I have a fairly standard Date Table in my Model
The one item a bit unconventional is a calculated column that returns a single character for the Month Name unless the month is Jan then return single character and Year like this J2023

All well and good, everything in the Calc Column look correct.
The problem is when I try to use the Abbreviated Name as the X Axis it is in the wrong order

I tried sorting by the Date Column and the DateKey column, but I get the message, "Cannot sort becuase there can be more than one value..."

What can I do to get the xaxis to show in the correct order?

Here's the DAX for my Calc Column

MonthNameAbbr =
VAR __MonthNbr = Month('DateTable'[Date])
VAR __MonthName = FORMAT( DateTable[Date], "MMMM")
VAR __Year = FORMAT( DateTable[Date], "YYYY")
VAR __MonthNameAbbr = CONCATENATE(
                        LEFT(__MonthName, 1),
                        REPT(UNICHAR(8203),__MonthNbr)
                    )
RETURN
    IF(
        __MonthNbr = 1,
        CONCATENATE(CONCATENATE(__MonthNameAbbr,UNICHAR(10)),__Year),
        __MonthNameAbbr
    )
 
Thanks,
-w
1 ACCEPTED SOLUTION
grantsamborn
Solution Sage
Solution Sage

Hi @UncleLewis 

If you have a [MonthNo] column in 'DateTable', try sorting by that.

View solution in original post

2 REPLIES 2
UncleLewis
Responsive Resident
Responsive Resident

Thanks grantsamborn,

That solved it - good to go.

Thanks,

-w

Line Chart.png

grantsamborn
Solution Sage
Solution Sage

Hi @UncleLewis 

If you have a [MonthNo] column in 'DateTable', try sorting by that.

Helpful resources

Announcements
Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.