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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Jsaidtecnimont
Frequent Visitor

Creating a table that checks matches two values to another table to replace the values

Ok so I am having trouble with a connection between two tables where I would like to replace the "Object Code" in the big data table with the "New Object Codes" based on the original "Object Code" but they are also based on the "Project" and I found it easier to create a new query that has the three columns: "Project", "Old Object Code", "New Object Code". This is all based on the Object Type, some will be changed and others not.

 

Example of First Query:

ProjectObject CodeObject TypeDescUnitsWeight
1AUnderground   
1BSubstation   
2AUnderground   

 

Example of New Query:

ProjectOld Object CodeNew Object Code
1AQ
2AF

 

So I would want to replace all the Object Codes in the first query with the new object code, but as you can see it is based on both the project and the old object code and isn't necissarily the same across the projects. Also it is limited only to the "underground" object type only that needs to be changed. Is there a way where I can create this double check?

 

Thanks in advance

2 ACCEPTED SOLUTIONS
BA_Pete
Super User
Super User

Hi @Jsaidtecnimont ,

 

I think the simplest way to go about this would be to just Left Outer merge your New Query (NQ) onto your First Query (FQ) on FQ[Project] and FQ[Object Code] = NQ[Project] and NQ[Old Object Code].

 

You can do a two-field merge by using Ctrl+click on the fields in the merge dialog. Make sure to Ctrl+click the fields in the same order on each table:

BA_Pete_1-1688465210523.png

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




View solution in original post

serpiva64
Super User
Super User

Hi,

if i understood you want to get in the first table the new object code

you need to merge the first query this way

serpiva64_0-1688465376342.png

then expand this way 

serpiva64_1-1688465409654.png

 

and you get this

serpiva64_2-1688465441958.png

If this post is useful to help you to solve your issue consider giving the post a thumbs up 

 and accepting it as a solution !

 

 

 

View solution in original post

5 REPLIES 5
serpiva64
Super User
Super User

Hi,

if i understood you want to get in the first table the new object code

you need to merge the first query this way

serpiva64_0-1688465376342.png

then expand this way 

serpiva64_1-1688465409654.png

 

and you get this

serpiva64_2-1688465441958.png

If this post is useful to help you to solve your issue consider giving the post a thumbs up 

 and accepting it as a solution !

 

 

 

Thank you for your response! Unfortunately, I left out the important part of having some elements checked while others not based on object type. I re-edited the question. Sorry for the mistake.

BA_Pete
Super User
Super User

Hi @Jsaidtecnimont ,

 

I think the simplest way to go about this would be to just Left Outer merge your New Query (NQ) onto your First Query (FQ) on FQ[Project] and FQ[Object Code] = NQ[Project] and NQ[Old Object Code].

 

You can do a two-field merge by using Ctrl+click on the fields in the merge dialog. Make sure to Ctrl+click the fields in the same order on each table:

BA_Pete_1-1688465210523.png

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




That's great! Thank you for the quick response, but I realized I forgot to mention, not all new object codes should be changed that's why I'm not merging. I have another column for example that states object type, and only a specific type of object needs new object codes, does that make sense?

 

I will edit the original question, sorry for the missing information.

I think it is not a problem. Once you have merged you create a conditional column that gets the new or the old object code based on your type of object

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.