cancel
Showing results for
Did you mean:

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a \$100 discount. Register Now

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.

Best regards

1 ACCEPTED SOLUTION
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
)
``````

Proud to be a Super User!

"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.
2 REPLIES 2
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
)
``````

Proud to be a Super User!

"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.
Community Support

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

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Announcements

#### Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

#### Power BI Monthly Update - February 2024

Check out the February 2024 Power BI update to learn about new features.

#### Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

#### Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Solution Authors
Top Kudoed Authors