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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
vqps8866
Regular Visitor

Find a list of names in a text field

Does anyone have any ideas on how I can accomplish the following task?

I have a list of sites and need to find the name of the site in a text field and, if found, retrieve its name.
I used a formula, but it slowed down processing.
Does anyone have any suggestions?

List in the List table.
The rawdata table has a description field where I will search for the name of the device from the list.

 

I am using this  formula:

 

Device Name =
VAR ListaSites = VALUES(List[List]) -- sua lista de sites
VAR Descricao = [Description]
VAR Resultado =
    CALCULATE(
        FIRSTNONBLANK(List[List], 1),
        FILTER(
            ListaSites,
            CONTAINSSTRING(Descricao, List[List])
        )
    )
RETURN
IF(
    ISBLANK(Resultado),
    "REQ",
    Resultado
)
 
Many Tks All
1 ACCEPTED SOLUTION
Greg_Deckler
Community Champion
Community Champion

@vqps8866 That doesn't look right, CONTAINSSTRING takes 2 text parameters not a text parameter and a table. If you can provide sample data as text, this would be easier but maybe something like the following:

Device Name (Column?) =
  VAR __ListaSites = DISTINCT( 'List'[List] )
  VAR __Descricao = [Description] 
  VAR __Resultado = 
    MAXX(
      FILTER(
        ADDCOLUMNS( 
          __ListaSites,
          "__Found", CONTAINSSTRING( [List], __Descricao )
        ),
        [__Found] = TRUE()
       ),
       [List]
    )
   VAR __Result = IF( __Resultado = BLANK(), "REQ", __Resultado )
RETURN
   __Result


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...

View solution in original post

5 REPLIES 5
vqps8866
Regular Visitor

Hello Greg,

Your formula worked perfectly.
Thank you very much for your help.

vqps8866
Regular Visitor

Hello

 

How are you?

 

What happens is that I have a list of 3,000 site names and I need to look in a field called description, which contains various data and the site name as well.
I need to find which website name is in the field and write down the name that was found.

I even thought of something like this, but there are 3,000 names:


SWITCH(
TRUE(),
CONTAINSSTRING([device name], “AR-ACA-API-001”), “AR-ACA-API-001”,
CONTAINSSTRING([device name], “AR-AME-DISP”), “AR-AME-DISP”,
....

I am using another one but the processing time is too long:

 

Device Name =
VAR ListaSites = VALUES(List[List]) -- sua lista de sites
VAR Descricao = [Description]
VAR Resultado =
    CALCULATE(
        FIRSTNONBLANK(List[List], 1),
        FILTER(
            ListaSites,
            CONTAINSSTRING(Descricao, List[List])
        )
    )
RETURN
IF(
    ISBLANK(Resultado),
    "REQ",
    Resultado
)
 
Many tks for tyhe support.

Hi @vqps8866,

 

Thank you for clarifying the requirement. Given that you have about 3,000 site names, using SWITCH or checking each row with CONTAINSSTRING would be quite inefficient. Instead, you can try a more efficient method with MAXX and ADDCOLUMNS to dynamically check for matches.

 

Device Name =
VAR __ListaSites = DISTINCT('List'[List])
VAR __Descricao = [Description]
VAR __Resultado =
   MAXX(
       FILTER(
           ADDCOLUMNS(
               __ListaSites,
               "__Found", CONTAINSSTRING(__Descricao, [List])
           ),
           [__Found] = TRUE()
       ),
       [List]
   )
RETURN IF(ISBLANK(__Resultado), "REQ", __Resultado)

Thank you.

Azadsingh
Helper I
Helper I

Hi @vqps8866 , Could you please eloborate a little and also help with sample column or data. Please try below formula if it works for you:

 

Device Name =VAR Descricao = RawData[Description]RETURNCOALESCE (CALCULATE (FIRSTNONBLANK ( List[List], 1 ),FILTER (List,CONTAINSSTRING ( Descricao, List[List] ))),"REQ")

 

Thanks,
Azad Singh Thakur
Power BI Enthusiast | LinkedIn: https://www.linkedin.com/in/thakurazad/

Greg_Deckler
Community Champion
Community Champion

@vqps8866 That doesn't look right, CONTAINSSTRING takes 2 text parameters not a text parameter and a table. If you can provide sample data as text, this would be easier but maybe something like the following:

Device Name (Column?) =
  VAR __ListaSites = DISTINCT( 'List'[List] )
  VAR __Descricao = [Description] 
  VAR __Resultado = 
    MAXX(
      FILTER(
        ADDCOLUMNS( 
          __ListaSites,
          "__Found", CONTAINSSTRING( [List], __Descricao )
        ),
        [__Found] = TRUE()
       ),
       [List]
    )
   VAR __Result = IF( __Resultado = BLANK(), "REQ", __Resultado )
RETURN
   __Result


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
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.