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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
tecumseh
Resolver I
Resolver I

Sort Month Single Letter Multiple Years

Hi all,

Using PBID Oct, 2024.

I created a Calc Column in my Date Table for the Initial of the month name and made it unique using UNICHAR(8203) below
I'm trying to sort this columns but I keep getting "More than 1 value in the Sort Column for the Name Column.
Ideas what I'm missing?
Thanks,

w

 

DAX

Month Name Initial =
VAR __Charcter = UNICHAR(8203)

VAR __CharCount = 'Date Table'[MonthNumber] + 'Date Table'[Year]

VAR __MonthLabel = LEFT('Date Table'[MonthName],1)

RETURN

CONCATENATE(

    __MonthLabel,

    REPT(__Charcter,__CharCount)

)
 
Sort Year Month = VALUE(YEAR('Date Table'[Date]) & FORMAT(MONTH('Date Table'[Date]),"00"))
 
 
1 ACCEPTED SOLUTION
v-xiaocliu-msft
Community Support
Community Support

Hi  @tecumseh  , 

 

Unfortunately, we can’t seem to hide columns in a bar chart like we can hide columns in a table.

As a workaround, please try to create a rank column. The ranking value is determined by the [year Month] column.

This method can be used to reduce the number of zero-width characters to avoid errors during sorting.

vxiaocliumsft_0-1731550888694.png

vxiaocliumsft_6-1731551080089.png

 

vxiaocliumsft_7-1731551088282.png

Column = RANKX(VALUES('Table'[Sort Year Month]),[Sort Year Month],,ASC)
 
 
Month Name Initial =
VAR __Charcter = UNICHAR(8203)
//VAR __CharCount = 'Table'[MonthNumber] + 'Table'[Year]
VAR __MonthLabel = LEFT('Table'[MonthName],1)
RETURN
CONCATENATE(
    __MonthLabel,
    REPT(__Charcter,[Column])
)
 
Best Regards,
Wearsky

View solution in original post

6 REPLIES 6
v-xiaocliu-msft
Community Support
Community Support

Hi  @tecumseh  , 

 

Unfortunately, we can’t seem to hide columns in a bar chart like we can hide columns in a table.

As a workaround, please try to create a rank column. The ranking value is determined by the [year Month] column.

This method can be used to reduce the number of zero-width characters to avoid errors during sorting.

vxiaocliumsft_0-1731550888694.png

vxiaocliumsft_6-1731551080089.png

 

vxiaocliumsft_7-1731551088282.png

Column = RANKX(VALUES('Table'[Sort Year Month]),[Sort Year Month],,ASC)
 
 
Month Name Initial =
VAR __Charcter = UNICHAR(8203)
//VAR __CharCount = 'Table'[MonthNumber] + 'Table'[Year]
VAR __MonthLabel = LEFT('Table'[MonthName],1)
RETURN
CONCATENATE(
    __MonthLabel,
    REPT(__Charcter,[Column])
)
 
Best Regards,
Wearsky
v-xiaocliu-msft
Community Support
Community Support

Hi @tecumseh ,

 

After further research, I think it's the zero width space string is too long causing the sort to fail.

As a workaround, please try to sort in visula rather than sort in table. And then you can hide the column.

vxiaocliumsft_3-1731481063767.png

 

Best Regards,

Wearsky

@v-xiaocliu-msft 

The Rankx solution is returning a circular reference error.

Any thoughts?

Sample pbix is here

 

thanks,

-w

rank_sort.png

Thanks @v-xiaocliu-msft ,

I'm using a Clustered Column Chart
I sorted the axis on your solution so that looks great
But I cant figure out how to hide the Sort Year Month column on the x axis?

Col Chart.png

Thanks,
-w

Jihwan_Kim
Super User
Super User

Hi,

I am not sure if I understood your question correctly, but please check the below picture and the attached pbix file.

 

Jihwan_Kim_0-1731433049456.png

 

 

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

Thanks @Jihwan_Kim ,

Add the year to your matrix and you will see same issue I am having getting proper sort.
You'll see
J 2023
J 2024
F 2023
F 2024

I need to show J - D 2023 followed by J - D 2024.
Thanks
-w

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!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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