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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
MP_123
Microsoft Employee
Microsoft Employee

merge two strings and sort alphabetically

hi

i want to combine two strings but i want the combining will be alphabetically

i know the contanatex function but i can't control the sort with this function

do you have an idea?

 

thanks!

7 REPLIES 7
sdjensen
Solution Sage
Solution Sage

Could you please provide a little more information? Perhaps some example of your data in your 2 columns and specify which value you want your new column to sort by - where is it you want the sorting?

/sdjensen
MP_123
Microsoft Employee
Microsoft Employee

@sdjensen,i have slicer with products for example

and i want to create new column/measure that combine the selected items on the slicer

for example

bread

milk

jam

chocolate

so if i selected the two , the new column will be chocolate,milk

and if i don't select nothing it will be bread, chocolate, jam, milk

 

thanks!

 

@MP_123 You could try this formula as a measure...

 

string = CONCATENATEX( Table1; Table1[Product]; ", "; Table1[Product])

 

/sdjensen
MP_123
Microsoft Employee
Microsoft Employee

yes you're right,

but the problem that this function not sort by abc always, it's inconsistent

After I added the 4 parameter in the query "; Table1[Product]" it sort correctly in my test with the 4 values you provided.

 

Concatenatex.png

/sdjensen

@MP_123 -  You could perhaps try to add a 5th parameter

 

string = CONCATENATEX( Table1; Table1[Product]; ", "; Table1[Product]; ASC)
/sdjensen
MP_123
Microsoft Employee
Microsoft Employee

it was my problem

the table need to be sorted and that's the way the function sort, like the table

 

thanks!

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Kudoed Authors