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
msupg21
New Member

Writing a conditional column from another column in another table

Table 1 has a column: [region = "3300" as text]

Table 2 has a column [station = "3300 - Southwest Office"]

Essentially, I need to lookup values from table 2's "station" column using table 1's "regions" value of a 4 digit string. Since there should be an exact match in the first four characters of station I should be able to do this in a conditional column add (I think). Then I need to create a new column in table 1 that returns the full value of "station" from table 2 given the match.

Not sure how to do this in the query editor since there are no relationships between these two tables.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

HI,@msupg21 

Regarding the issue you raised, my solution is as follows:

1.First I have created the following table and the column names and data are the data you have given:

vlinyulumsft_0-1720755205358.png

vlinyulumsft_1-1720755210607.png

2.Then station table add custom columns in PowerQuery:

vlinyulumsft_2-1720755231368.png

vlinyulumsft_3-1720755236655.png

Text.Start([station],4)

3.Finally, use the merge query in the region table to expand:

vlinyulumsft_4-1720755274991.png

4.Here are my end results, I hope to meet your needs:

vlinyulumsft_5-1720755288745.png

Note that the data types of the columns are consistent when merging queries.

 

Please find the attached pbix relevant to the case.

 

Best Regards,

Leroy Lu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

 

 

View solution in original post

1 REPLY 1
Anonymous
Not applicable

HI,@msupg21 

Regarding the issue you raised, my solution is as follows:

1.First I have created the following table and the column names and data are the data you have given:

vlinyulumsft_0-1720755205358.png

vlinyulumsft_1-1720755210607.png

2.Then station table add custom columns in PowerQuery:

vlinyulumsft_2-1720755231368.png

vlinyulumsft_3-1720755236655.png

Text.Start([station],4)

3.Finally, use the merge query in the region table to expand:

vlinyulumsft_4-1720755274991.png

4.Here are my end results, I hope to meet your needs:

vlinyulumsft_5-1720755288745.png

Note that the data types of the columns are consistent when merging queries.

 

Please find the attached pbix relevant to the case.

 

Best Regards,

Leroy Lu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

 

 

Helpful resources

Announcements
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 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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