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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

Merge changes a string formed with Text.Combine

Hi, everyone!

 

I have a series of events that I am combining in a single string in order to be able to use the PATH... functions to examine them -- the events have a code that differentiates them, that's what I'm concatenating. 

 

The chains of events are created using Text.Combine, after sorting them using a unique combination of values and grouping using the id of the entity to which the events are related.

 

#"Sorted Rows1" = Table.Sort(#"Changed Type",{{"entityNumber", Order.Ascending}, {"key", Order.Ascending}}),
#"Grouped Rows1" = Table.Group(#"Sorted Rows1", {"entityNumber"}, {{"Table", each _, type table [key=text, eventNumber=text, eventCode=text, eventDate=date]}}),
= Table.AddColumn(#"Grouped Rows1", "chainEvent", each Text.Combine ( [Table][eventCode], "|"))

 

This works very well. Here is an example of a chain of events according to their codes. They are in the correct order in which they were sorted.

 

02.10|02.01|03.01|03.08|06.06.01|06.01|09.01|16.01

 

However, this is done in a table I don't really need, and to decrease the number of tables in the model, I wanted to merge it into the one comprising the entities to which the events pertain, and simply do not load the first table.

 

This was my intent. But, to my surprise, after the merge, the strings in the new column in the Entities table had changed. The order of the events was scrambled. Actually, I checked and the order had been returned to what it was before the sort.

 

06.01|06.06.01|02.10|09.01|02.01|16.01|03.01|03.08

 

The palliative solution I found was keeping the table with the calculated strings and setting a relation to the Entities table. Before the merge, the order is correct, so I have no problem in using the strings that are there.

 

Although the model is working perfectly with this one more table, it seems to me that this is a bug that should be addressed.

Any thoughts would be welcome. Thank you!!

 

 

2 REPLIES 2
Anonymous
Not applicable

Hi, just stumbled on this thread as I am having the exact same issue. Not sure why but adding a Table.Buffer step at the end of your first query seems to "lock into place" the order of the combined fields: you should be able to further use it in Merge queries without unwanted swaps.

Hope this helps!

Greg_Deckler
Community Champion
Community Champion

@edhans  and @ImkeF this sounds like a weird one for you.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

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.

Top Solution Authors
Top Kudoed Authors