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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
roniedhaka
Frequent Visitor

new table from existing table with rows contains specific word/text in specific column

hi,

 

i need help to extract specific word/text from a string of characters - like text/word example 'wifi' or 'wi-fi' or 'AP' etc and generate a new table with only rows with that contain specific text/word from a specific column cell.

 

lets say i have a existing power BI table with 100+ rows and 8 columns. in some rows has this type of text/word in column number-4.

I need to generate a new table with rows contains that informations (rows contain that text/word) & discard rest of rows. How?

2 ACCEPTED SOLUTIONS

@roniedhaka , try this

New Table = FILTER('Table',
CONTAINSSTRING('Table'[fruits],"Mango") ||
CONTAINSSTRING('Table'[fruits],"lichie") ||
CONTAINSSTRING('Table'[fruits],"lichee"))

Arul_0-1707371739335.png





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!


LinkedIn


View solution in original post

@roniedhaka ,

this should work,

New Table = FILTER(
    'Table',
    (CONTAINSSTRING('Table'[fruits], "Mango") ||
     CONTAINSSTRING('Table'[fruits], "lichie") ||
     CONTAINSSTRING('Table'[fruits], "lichee")) &&
    ('Table'[year] = 2023 || 'Table'[year] = 2021)
)




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!


LinkedIn


View solution in original post

8 REPLIES 8
Arul
Super User
Super User

@roniedhaka ,

Can you provide atleat 5-10 rows of sample data?





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!


LinkedIn


country-idaccount-idfruitsweight /kgprice total kusdyear
1234abcd123mango4321152021
5678efgh456lichee1234182022
3456ijkl789dates_mango_orange2468222024
6789mnop246Mango-steen1357212021

 

here is an example table.

i need to transform this table into a new table but limited rows which fruits column contains the word 'mango' or 'Mango' or 'Mango-steen' (appearently 3 rows as per above table, and rest rows discarded).

@roniedhaka ,

try this

New Table = FILTER('Table',CONTAINSSTRING('Table'[fruits],"Mango"))

Arul_0-1707367742491.png

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!


LinkedIn


thanks,  sorry i ahve to add few more rows to explain a little more.

 

what i can do if also keep mango and lichee and lichi?

 

country-idaccount-idfruitsweight /kgprice total kusdyear
1234abcd123mango4321152021
5678efgh456lichee1234182022
3456ijkl789dates_mango_orange2468222024
6789mnop246Mango-steen1357212021
2468wxyz024mangosteen & apple1234202020
1357qrst135jackfruit5678192024
5432uvwx345lichie3456222023

@roniedhaka , try this

New Table = FILTER('Table',
CONTAINSSTRING('Table'[fruits],"Mango") ||
CONTAINSSTRING('Table'[fruits],"lichie") ||
CONTAINSSTRING('Table'[fruits],"lichee"))

Arul_0-1707371739335.png





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!


LinkedIn


many thanks, this should be it.

one more thing - if i want year 2021 & 2023 rows only, with those specific word/text?

@roniedhaka ,

this should work,

New Table = FILTER(
    'Table',
    (CONTAINSSTRING('Table'[fruits], "Mango") ||
     CONTAINSSTRING('Table'[fruits], "lichie") ||
     CONTAINSSTRING('Table'[fruits], "lichee")) &&
    ('Table'[year] = 2023 || 'Table'[year] = 2021)
)




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!


LinkedIn


hi, thanks. that solved my problem 80%. But still i have some issues. Let me give the details of it.

the word/text i choose like mango, it is easy to extract. But in real problem i have to extraxt a specific word/text which sometimes appears inside within a big text/word and that unwanted row is chosen.

 

example - i like to extract word 'AX' & 'wifi' & 'wi-fi' only. Sometimes AX is in mix with other letters formed new word like 'Max', 'Tax', 'dax' etc. Means ax is inside of these words and those rows are unwanted.

 

i want - 

  1. only rows with containts string 'AX' only. Not mix with other letter. Those max, tax, dax rows we can avoid.
  2. If max, tax, dax type rows contain 'wifi' or 'wi-fi' - i need that row.
  3. 'wifi' text also need with same attributes like point-1, only word with 'wifi' or 'wi-fi'

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!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

Feb2025 NL Carousel

Fabric Community Update - February 2025

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