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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Best practice: Aggregating Merging columns from two tables

I have two tables with one field in common. I'm trying to basically create a new table that has just a few columns from both tables, using one of the columns (employee ID) as a reference. What I would like to end up with is something like a matrix table that sums/counts values across the columns for each employee ID. Can you suggest article or best way to create a new table?

2 ACCEPTED SOLUTIONS
az38
Community Champion
Community Champion

so, @Anonymous  it's still should aggregate the data correct in power BI desktop version

also, for the cases like that is a good practice to create a bridge calculated table

bridgeTableEmployee = DISTINCT('Table A'[EmployeeID])

then create 2 pairs of relationships (many to one both):

Table A -> bridge

Table B - > bridge

 

do not hesitate to give a kudo to useful posts and mark solutions as solution


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

View solution in original post

Anonymous
Not applicable

@az38... ah, I see what I did wrong in the formula... this looks much better..! I can use the bridge in some other reports that have the same issue of many to many.. thanks very much and have a good new year holiday!

 

 

 

bridge table.jpg

View solution in original post

8 REPLIES 8
az38
Community Champion
Community Champion

@Anonymous 

usually in the most common and simpliest case, you don't need a new table, just create relationships between tables and aggregate your data in visual

do not hesitate to give a kudo to useful posts and mark solutions as solution


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn
Anonymous
Not applicable

Thanks, that's even better not creating a new table... question on the relationship... Table A has the data the end users are wanting to use. Table B has additional columns they would like to see. Both tables have EmployeeID to join with. Table A should look up EmployeeID from Table B (similar to vlookup). Is there a particular type of join i need to use( inner, outer, left, right) so Table A uses only the EmployeeID needed from Table B?

az38
Community Champion
Community Champion

@Anonymous 

the best scenario is one-to-many relationships

if each EmployeeID in Table A is unique (one row=one EmployeeID), you create a visual then you dont even need to vlookup something, just add fields from different tables in your visual

 

do not hesitate to give a kudo to useful posts and mark solutions as solution


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn
Anonymous
Not applicable

That's the part I'm trying to figure out... the EmployeeID's in Table A and Table B is not unique. For example, an employee may have several different audits during a day. When I created a relationship between the two tables, the only type it would allow is many to many.

az38
Community Champion
Community Champion

so, @Anonymous  it's still should aggregate the data correct in power BI desktop version

also, for the cases like that is a good practice to create a bridge calculated table

bridgeTableEmployee = DISTINCT('Table A'[EmployeeID])

then create 2 pairs of relationships (many to one both):

Table A -> bridge

Table B - > bridge

 

do not hesitate to give a kudo to useful posts and mark solutions as solution


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn
Anonymous
Not applicable

Hi @az38  I'm doing something wrong or missed a step...? I created the bridge table and linked the NetworkID's in both tables... the relationship is showing many to many, and doesn't allow selecting one to many...

 

bridge table.jpg

 

 

 

az38
Community Champion
Community Champion

@Anonymous 

it looks strange, because I see a star symbol "*" near bridge table.

It could means the only one - your values NetworkID in bridge are not unique

are sure you create this table like

= DISTINCT('Table A'[NetworkID])

?

 

do not hesitate to give a kudo to useful posts and mark solutions as solution


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn
Anonymous
Not applicable

@az38... ah, I see what I did wrong in the formula... this looks much better..! I can use the bridge in some other reports that have the same issue of many to many.. thanks very much and have a good new year holiday!

 

 

 

bridge table.jpg

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors