Get certified for free when you join Fabric Data Days 2026 and dive into Fabric, Power BI, SQL, AI, and other essential data skills.
Join nowData Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more
Hi everyone,
I have the following situation:
1-) I have a table called 'Expense Category' as shown below:
2-) I have a second table with credit card statement called 'CreditCard':
What I need to achieve:
- I want Power BI to compare the column [Expense Detail] to the column [Detail] in the first table. If the 'Expese Detail' description contains any of the words in the column 'Detail', power BI will bring the correspondent 'Category' value to my CreditCard table in a new column 'Category' just beside the 'Account' column
Something like this:
any thoughts ?
thanks!
Julio
Solved! Go to Solution.
Hi @Anonymous ,
Please try like:
= Table.AddColumn(#"Changed Type", "Category", each Table.SelectRows(#"Expense Category",(x)=>Text.Contains([Expense Detail],x[Detail],Comparer.OrdinalIgnoreCase))[Category]{0})
and then repalce error.
Best Regards,
Gao
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data
Hi Bifinity_75, I tested your solution, and it worked great also. I've got two distinct solutions for the same issue. appreciated. thanks.
Hi @Anonymous , try this calculate column:
Category =
maxx(filter('Expense Category' ,
search('Expense Category'[Detail], CreditCard[Expense Detail],,0)>0),'Expense Category'[Detail]
)
Best regards
Hi Bifinity_75, I tested your solution, and it worked great also. I've got two distinct solutions for the same issue. appreciated. thanks.
Hi @Anonymous ,
Please try like:
= Table.AddColumn(#"Changed Type", "Category", each Table.SelectRows(#"Expense Category",(x)=>Text.Contains([Expense Detail],x[Detail],Comparer.OrdinalIgnoreCase))[Category]{0})
and then repalce error.
Best Regards,
Gao
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data
it worked nice Gao, thanks! one more question, in a case where there is no match between 'Expense Detail' and the 'Detail' column, how can I get 'Others' as a result for the Category instead of the error message shown below?
thanks!
Julio
Good point daXtreme...! I'm gonna follow your suggestion above...many thanks!
I wouldn't do that. It'll be painfully slow on a bigger data set. Instead, I'd use Power Query to break down the phrases into individual words stored in one column and then use such a table to match against these words. This is acually how it should be handled in a professional model.
Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.
Check out the May 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 23 | |
| 21 | |
| 20 | |
| 17 | |
| 13 |
| User | Count |
|---|---|
| 58 | |
| 51 | |
| 37 | |
| 30 | |
| 26 |