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
patrick3
Helper II
Helper II

DAX - New table, adding specific values based on original column

Hi all,

 

Not 100% sure how to explain this, but I'll try.

 

Let's say ive got a table with 2 columns:

UserId, Package Code

 

And another table with 2 columns:

Package Code, Product Code

 

My goal is to create 1 new table which has all the data from Table 1, but adds the relevant Product Codes as well. Each Package code could have 1, 2 or more Product Codes.

 

Any thoughts on how to approach this?

 

Thanks in advance!

 

 

1 ACCEPTED SOLUTION

Hi,

In the Query Editor, merge Table2 into Table1 based on the Package Code.  If a Package code has multiple Product codes, then multiple lines will get created in the merged dataset.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

5 REPLIES 5
Ashish_Mathur
Super User
Super User

Hi,

Create a relationship (Many to One and Single) from the Package Code column of Table2 to the Package code column of Table1.  To your visual, drag Package code from Table1 and Product code from Table 2.

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi,

 

That would work, except I will need to do further calculations on the table, which cannot be done just in a measure

Hi,

In the Query Editor, merge Table2 into Table1 based on the Package Code.  If a Package code has multiple Product codes, then multiple lines will get created in the merged dataset.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Samarth_18
Community Champion
Community Champion

Hi @patrick3 ,

 

You can directly create a column in table 1 with below code:

 

 

column = lookupvalue(table2[product_code],table2[Package Code],table[Package Code])

 

 

Please let me know if i am gettting your question correctly.

 

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

Sorry, I may not have explained well - that would work only if there was 1 Product Code per package but there would be multiple.

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.