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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
MP_123
Employee
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

@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

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

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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