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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Luis_Gomez
Frequent Visitor

Create a list from another table to feed a custom function

Hi all,

 

I have a custom fuction that counts the times words on a list are found in a string:

 

 

let
    CountKeywords = (title as text, keywords as list) as number =>
        let
            words = Text.Split(title, " "),
            matches = List.Count(List.Intersect({words, keywords}, Comparer.OrdinalIgnoreCase))
        in
            matches
in
    CountKeywords

 

 

Inside the code I hard coded a list and use the function, it works

 

 

Keywords = {"One","Two","Three"}

AddedFound = Table.AddColumn(#"Filtered Rows1", "found", each Busca_cuantos([title], Keywords)),

 

 

Now, I want to create the list from a Table, but I get errors.

 

 

Keywords= = Table.ToList(Table.SelectColumns([Table],"Brand"))

 

The error reads:

 

Expression.Error: There is an unknown identifier. Did you use the [field] shorthand for a _[field] outside of an 'each' expression?

 

What I am missing here?

 

Thank you in advance for your kind support

 

 

1 ACCEPTED SOLUTION
Vijay_A_Verma
Most Valuable Professional
Most Valuable Professional

Keywords= Table.Column([Table],"Product")

[Table] - This refers to a cell

Table - This refers to entire table

Use like this

Table[Product]

OR

Table.Column(Table, "Product") ### This was my mistake to put Table as [Table]

View solution in original post

3 REPLIES 3
Vijay_A_Verma
Most Valuable Professional
Most Valuable Professional

To convert to a list - Table.Column([Table],"Brand")

It can also be written as Table[Brand}

Thank you.

I tried Table.Column same error mesagge. Here is the sequence of my code:

 

// Source and some cleaning...

#"Filtered Rows1" = Table.SelectRows(#"Changed Type", each ([Source.Name] <> "xxx.xlsx")),

//Keywords = {"One","Two","Three"}

Keywords= Table.Column([Table],"Product"), 

AddedFound = Table.AddColumn(#"Filtered Rows1", "found", each Busca_cuantos([title], Keywords)),

//Some conversions.....
   

 

Hope this helps to find the problem.

 

Regards

 

Vijay_A_Verma
Most Valuable Professional
Most Valuable Professional

Keywords= Table.Column([Table],"Product")

[Table] - This refers to a cell

Table - This refers to entire table

Use like this

Table[Product]

OR

Table.Column(Table, "Product") ### This was my mistake to put Table as [Table]

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

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.

Top Solution Authors