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
Anonymous
Not applicable

Remove more than 1 occurrence of Text - Keep the first and remove the rest

Hi folks

 

I have a column with X rows in text format. In this column I have data starting with: Balise: XxxXxxX  which is what I want to be.

However there are lines which have "Balise: XxxXxxX Balise: XxxXxxX Balise: XxxXxxX" I want to remove any occurrence of Balise: XxxXxxX after the first occurrence. 

It is important to notice that! The data is NOT in power query, which means we cannot use the tool duplicate or any code that is otherwise used in power query. 

This data and problem is in Power Bi Desktop. The data is duplicated because I used & to combine 2 columns and thus the places where same data is present it creates the duplicate.

balise.JPG

 

thank you

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi, Sorry for the late reply.

I see that i understood your question wrong at the start, im sorry. 

 

To use DAX to get the right answer you can use the following formulas:

To get the the right Bailse:

RightBailse = RIGHT(SUBSTITUTE(Table1[Bailser-Alle]," ","-"),LEN(SUBSTITUTE(Table1[Bailser-Alle]," ","-"))-SEARCH("-",SUBSTITUTE(Table1[Bailser-Alle]," ","-")))

And for the left part:

LeftBailse = LEFT(SUBSTITUTE(Table1[Bailser-Alle]," ","-"),SEARCH("-",SUBSTITUTE(Table1[Bailser-Alle]," ","-"))-1)

Output:

bailse.png

I hope this helps, goodluck.

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

If i understand correctly you want to remove the yellow highlighted text. 

If so; you can use the split column in the edit queries tab to remove the 16 most right characters. Then later remove the extra created column containing the text you wanted to remove.

 

 

Anonymous
Not applicable

Hi @Anonymous 

 

That is exactly what I dont want to do.  I cannot use "Edit Query" since the calculation happens at the current page. Therefore the Edit query option is the option before the calculation, thus its not usable.

 

Any other ways to split the current data?

Hi @Anonymous 

You may try below dax to create a new column.

Column = LEFT([Bailser-Alle],LEN([Bailser-Alle])-15)

1.png

Regards,

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

@v-cherch-msft 

 

Since the length of each text in Baliser-Alle is not the same, using Left and giving 15 character to keep is not useful as the texts which is longer than 15 character doesnt appear fully.

The ideal solution will be to use "Balise:" as reference point and say that keep data until second occurrence of "Balise: ".

However I am not sure how it is possible.. I know it initially is about excel coding, which i lack some info about.

Anonymous
Not applicable

Hi, Sorry for the late reply.

I see that i understood your question wrong at the start, im sorry. 

 

To use DAX to get the right answer you can use the following formulas:

To get the the right Bailse:

RightBailse = RIGHT(SUBSTITUTE(Table1[Bailser-Alle]," ","-"),LEN(SUBSTITUTE(Table1[Bailser-Alle]," ","-"))-SEARCH("-",SUBSTITUTE(Table1[Bailser-Alle]," ","-")))

And for the left part:

LeftBailse = LEFT(SUBSTITUTE(Table1[Bailser-Alle]," ","-"),SEARCH("-",SUBSTITUTE(Table1[Bailser-Alle]," ","-"))-1)

Output:

bailse.png

I hope this helps, goodluck.

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.