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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
kivancc94
Helper I
Helper I

Sorting Months by Concatanatex function

Hi,

I would be happy if you could help me. 

Trying to sort "Month Name" column by using Concatanatex function. But it s not sorting in a correct order.

kivancc94_0-1686642061749.png


Best regards

1 ACCEPTED SOLUTION
danextian
Super User
Super User

hi @kivancc94 ,

CONCATENATEX has  an argument for sorting. First create a Month Sort measure - based on test, the measure has to be created outside CONCATENATEX otherwise the values will not be in the expected order.

Month Sort Measure =
SELECTEDVALUE ( Dates[Month Number] )

or

Month Sort Measure =
MONTH ( Dates[Date] )

Then update your formula similar to below

MONTHS =
CONCATENATEX (
    VALUES ( Dates[Month Name] ),
    Dates[Month Name],
    UNICHAR ( 10 ),
    [Month Sort Measure], ASC
)

 

danextian_0-1686796810662.png

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

View solution in original post

2 REPLIES 2
danextian
Super User
Super User

hi @kivancc94 ,

CONCATENATEX has  an argument for sorting. First create a Month Sort measure - based on test, the measure has to be created outside CONCATENATEX otherwise the values will not be in the expected order.

Month Sort Measure =
SELECTEDVALUE ( Dates[Month Number] )

or

Month Sort Measure =
MONTH ( Dates[Date] )

Then update your formula similar to below

MONTHS =
CONCATENATEX (
    VALUES ( Dates[Month Name] ),
    Dates[Month Name],
    UNICHAR ( 10 ),
    [Month Sort Measure], ASC
)

 

danextian_0-1686796810662.png

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.
Anonymous
Not applicable

Hi @kivancc94,

I'd like to suggest you refer to the following link to create a custom table with raw field value and index field.

After you finish setting 'sort by column' property with index field value and link to the raw table field. You can use the new table field on slicer to filter records and keep with specific sorting orders.

Custom Sorting in Power BI 

Regards,

Xiaoxin Sheng

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.