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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
cher90
Helper II
Helper II

How to replace/remove text between delimiters when there are multiple delimiters ?

Hello, 

 

How to replace/remove text between delimiters when there are multiple delimiters ?

 

Case : 

 

value on the cell : 

 

aaa

bbb

ccc

eee

aaa

bbb

ccc

eee

aaa

bbb

ccc

xxx

eee

aaa

bbb

ccc

eee

aaa

bbb

ccc

xxx

eee

....

 

I am looking to remove only the values in red.

 

Thanks!

 

 

6 REPLIES 6
cher90
Helper II
Helper II

up

guess!!!

NewStep=Table.Combine(Table.Group(PreviousStepName,"Column1",{"n",each Table.RemoveLastN(_,each [Column1]<>"bbb")},0,(x,y)=>Byte.From(y="xxx"))[n])

Hello Daniel,

 

Thanks for your try.

 

This doesn't seem to work it erases all the value 😞

 

let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WSkxMjMmLyUtKSgJRycnJICo1NRVEkSxXUVFBHe1KsbEA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Colonne 1" = _t]),
#"Type modifié" = Table.TransformColumnTypes(Source,{{"Colonne 1", type text}}),
#"Colonnes renommées" = Table.RenameColumns(#"Type modifié",{{"Colonne 1", "Column1"}}),

NewStep=Table.Combine(Table.Group(#"Colonnes renommées","Column1",{"n",each Table.RemoveLastN(_,each [Column1]<>"bbb")},0,(x,y)=>Byte.From(y="xxx"))[n])
in
NewStep

 

 

NewStep= Table.TransformColumns(Source,{"Colonne 1",each let a=Table.FromList(Splitter.SplitTextByWhitespace()(_),each {_}) in Text.Combine(Table.Combine(Table.Group(a,"Column1",{"n",each Table.RemoveLastN(_,each [Column1]<>"bbb")},0,(x,y)=>Byte.From(y="xxx"))[n])[Column1],"#(lf)")})

Hello Daniel,

 

I tested but only the first occurrence is removed, and in the next pattern it's the end delimiter that is removed.

 

cher90_0-1666683785831.png

 

rather, everything after the start delimiter is removed with the second occurence.

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.

Top Solution Authors
Top Kudoed Authors