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
Nethunt
Frequent Visitor

Combine same tables from different companies

In addition to message https://community.powerbi.com/t5/Desktop/Combine-same-tables-with-from-different-companies/m-p/19853... we have an issue / question.

 

In our situation we have 10 companies; but that shouldn't be a problem (I think).

Added a column in each (company)query (name query and company has to different - so far so good).

In our case the primary key of a table is YearWeek.

In the table itself this key is unique. However combined not (then there are 10 the same primary keys).

 

After applying the query changes I got of course the following message:

Column "YearWeek" in Table 001 contains a duplicate value "201601" and this is not allowed for columns on the one side of a many-to-one relationship or for coluns that are used as the primary key of a table.

 

What is the best way to add unique primary keys to each table or an other way to solve this ?

 

TIA for replying

1 ACCEPTED SOLUTION
Eric_Zhang
Employee
Employee


@Nethunt wrote:

In addition to message https://community.powerbi.com/t5/Desktop/Combine-same-tables-with-from-different-companies/m-p/19853... we have an issue / question.

 

In our situation we have 10 companies; but that shouldn't be a problem (I think).

Added a column in each (company)query (name query and company has to different - so far so good).

In our case the primary key of a table is YearWeek.

In the table itself this key is unique. However combined not (then there are 10 the same primary keys).

 

After applying the query changes I got of course the following message:

Column "YearWeek" in Table 001 contains a duplicate value "201601" and this is not allowed for columns on the one side of a many-to-one relationship or for coluns that are used as the primary key of a table.

 

What is the best way to add unique primary keys to each table or an other way to solve this ?

 

TIA for replying


@Nethunt

Roughly speaking, you can try to create a composite column like "company1_201601" and this column contains unique values in your case. What is the many table in this relationship? Usually a better practice is putting the '201601' in a calendar table which is connected to Table001 with the column dates. 

View solution in original post

1 REPLY 1
Eric_Zhang
Employee
Employee


@Nethunt wrote:

In addition to message https://community.powerbi.com/t5/Desktop/Combine-same-tables-with-from-different-companies/m-p/19853... we have an issue / question.

 

In our situation we have 10 companies; but that shouldn't be a problem (I think).

Added a column in each (company)query (name query and company has to different - so far so good).

In our case the primary key of a table is YearWeek.

In the table itself this key is unique. However combined not (then there are 10 the same primary keys).

 

After applying the query changes I got of course the following message:

Column "YearWeek" in Table 001 contains a duplicate value "201601" and this is not allowed for columns on the one side of a many-to-one relationship or for coluns that are used as the primary key of a table.

 

What is the best way to add unique primary keys to each table or an other way to solve this ?

 

TIA for replying


@Nethunt

Roughly speaking, you can try to create a composite column like "company1_201601" and this column contains unique values in your case. What is the many table in this relationship? Usually a better practice is putting the '201601' in a calendar table which is connected to Table001 with the column dates. 

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.