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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Anonymous
Not applicable

Need help to remove few words within a column in Power BI

Hi everyone,

 

I am new to power bi and i would like to know if there is any way to remove some words within the whole column?

For eg. The variables within the property row are:

  1. Entire condo
  2. Private room in apartment
  3. Room in hotel
  4. Loft
  5. Room in apartment
  6. Shared room in condo
  7. Private room in hotel
  8. Tiny house
  9. Shared room
  10. Private room

I would like to remove the words "Entire",  "Private room in",  "Room in", "Shared room in"

 

Thank you very much in advance!

 

1 ACCEPTED SOLUTION
Jakinta
Solution Sage
Solution Sage

Here is another one...

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45Wcs0rySxKVUjOz0vJV4rViVYKKMosSyxJVSjKz89VyMxTSCxILCrJTc0rAcsGQUUz8ktSc8AiPvlpqFKoGoIzEotSU+Cm4bYHYWJIZl4lkFtanIpuAoZGpdhYAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [OldText = _t]),
    Words = {"Entire", "Private room in", "Room in", "Shared room in"},
    FINAL = Table.AddColumn(Source, "NewText", each 
            Text.Trim (List.Accumulate( {0..List.Count(Words)-1}, [OldText], 
            (s,c) => Text.Replace( s, Words{c}, "" ))))
in
    FINAL

Jakinta_0-1623388269017.png

 

View solution in original post

4 REPLIES 4
Jakinta
Solution Sage
Solution Sage

Here is another one...

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45Wcs0rySxKVUjOz0vJV4rViVYKKMosSyxJVSjKz89VyMxTSCxILCrJTc0rAcsGQUUz8ktSc8AiPvlpqFKoGoIzEotSU+Cm4bYHYWJIZl4lkFtanIpuAoZGpdhYAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [OldText = _t]),
    Words = {"Entire", "Private room in", "Room in", "Shared room in"},
    FINAL = Table.AddColumn(Source, "NewText", each 
            Text.Trim (List.Accumulate( {0..List.Count(Words)-1}, [OldText], 
            (s,c) => Text.Replace( s, Words{c}, "" ))))
in
    FINAL

Jakinta_0-1623388269017.png

 

Anonymous
Not applicable

Hi @Jakinta ,

 

Thank you very much for the help.

 

CNENFRNL
Community Champion
Community Champion

let
    Kw = {"Entire",  "Private room in",  "Room in", "Shared room in"},
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45Wcs0rySxKVUjOz0vJV4rViVYKKMosSyxJVSjKz89VyMxTSCxILCrJTc0rAcsGQUUz8ktSc8AiPvlpqFKoGoIzEotSU+Cm4bYHYWJIZl4lkFtanIpuAoZGpdhYAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Type = _t]),
    #"Added Custom" = Table.AddColumn(Source, "New", each List.Accumulate(Kw, [Type], (s,c) => let pos=Text.PositionOf(s,c,1,Comparer.OrdinalIgnoreCase) in if pos<>-1 then Text.Trim(Text.RemoveRange(s,pos,Text.Length(c))) else s))
in
    #"Added Custom"

Screenshot 2021-06-10 211144.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

Anonymous
Not applicable

Hi @CNENFRNL ,

 

Thank you very much for the help.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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

Users online (756)