cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
UncleLewis
Helper V
Helper V

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
Helper V
Helper V

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
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors