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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Anonymous
Not applicable

Structuring and cleaning a column by using reference tables

Hi,

I am building an app to analyse my bank transactions. These transactions have two columns that contain more or less information stored in an unstructured manner. My plan is to use reference tables (that I already have loaded into the model) to extract and structure data from these two columns. I have for example tables with places, country codes, and company names.

 

I have solved this problem with DAX formula's.

First I look into the reference table to find data using the following formula:

 

MAXX(FILTER(Country, SEARCH(" " & Country[Country code], Transaction[Description],,0)>0),Country[Country code])

 

Then I will calculate a new column which removes the country code, and then I will use this column to search for the next one.

 

My problem:

My approach convolutes the model with data I only use for ETL purpoces. Therefore I would like to solve this problem in Power Query.

Question:

How do I solve this problem in Power Query?

3 REPLIES 3
v-kkf-msft
Community Support
Community Support

Hi @Anonymous ,

 

Has your problem been solved? If it is solved, please mark a reply which is helpful to you.

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.


Best Regards,
Winniz

v-kkf-msft
Community Support
Community Support

Hi @Anonymous ,

 

Are you trying to implement the logic of the above DAX in PQ? If so, please try the following custom column.

 

= 
let 
   CurrentDec = [Description], 
   SelectRows = Table.SelectRows(Country, each Text.Contains(CurrentDec, " " & [Country code], Comparer.OrdinalIgnoreCase))[Country code]
in 
   List.Max(SelectRows)

vkkfmsft_0-1655189589914.png

vkkfmsft_1-1655189631006.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

lbendlin
Super User
Super User

Please provide sanitized sample data that fully covers your issue. If you paste the data into a table in your post or use one of the file services it will be easier to assist you. I cannot use screenshots of your source data.

Please show the expected outcome based on the sample data you provided. Screenshots of the expected outcome are ok.

https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.