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
zack
Frequent Visitor

Create column based on occurence of string value contained in lookup table

I need to show how many transactions have payees from a watch list. There are two files, the monthly transaction file and a watch list containing essentially one field.

 

  • The primary file contains ~80k records each month, with one field labled "Description" that includes payee info. There's no real pattern.
  • The second file is a lookup table containg about 20 records with a field labled "Name" that contains the word or words I want to scan for.
  • The result should be a new column in the primary file with a value that is either true or false, or contains the word that matched. (i'm not sure which is better).

 

I don't know where to start. I have a basic understanding of M and DAX. I know how to use the Advanced Editor. But I'm no programer. just a hack. 😉

 

 

1 ACCEPTED SOLUTION
v-shex-msft
Community Support
Community Support

Hi @zack,

 

You can use contains function to check if the value is contained in search table.

 

Measure:

 

IsContains = 
var currItem= LASTNONBLANK('CurrentTable'[ColumnName],[ColumnName])
return
CONTAINS(SearchTable,SearchTable[ColumnName],currItem)

 

 

Then drag above measure and the watch item column to a table visaul.

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

3 REPLIES 3
v-shex-msft
Community Support
Community Support

Hi @zack,

 

You can use contains function to check if the value is contained in search table.

 

Measure:

 

IsContains = 
var currItem= LASTNONBLANK('CurrentTable'[ColumnName],[ColumnName])
return
CONTAINS(SearchTable,SearchTable[ColumnName],currItem)

 

 

Then drag above measure and the watch item column to a table visaul.

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
paulag
Advocate I
Advocate I

Is the second file the watch list?

zack
Frequent Visitor

Yes.

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.