Forum Discussion

robbieinoz's avatar
robbieinoz
Frequent Visitor
9 years ago
Solved

Data categorization and labeling based on a criteria list

Hi!   I have a very large list of transactions and I am attempting to use powerbi to categorize these transactions based on a narrative field in the transaction list, containing certain text. I hav...
  • robbieinoz's avatar
    robbieinoz
    9 years ago

    Ok I have solved this. Here's how:

     

    I created a new column in my transaction table with the following formula:

     

    MatchFound= 
    FIRSTNONBLANK(
    FILTER(
    values('Keyword Table'[Narrative Contains]),
    search('Keyword Table'[Narrative Contains],'Transaction list'[Narrative],1,0)
    )
    ,1)

    This formula returns the matching value found within the narrative string. I can then use this with a lookup formula, to return the corresponding category:

    category = 
    LOOKUPVALUE(
    'Keyword Table'[Category],'Keyword Table'[Narrative Contains],'Transaction list'[MatchFound]
    )

    And voila! My transaction list is now categorized by searching the a narrative field to see if it contains any item from a list of keywords paired with categories...