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
RossBateman
Helper I
Helper I

Creating a Relationship Error

I have two tables with an invoice number being the unique field in both. When trying to create it comes up with the error message of ‘You can’t create a relationship between these two columns because one of the columns must have unique values’. 

 

I've removed duplicate rows on both tables but the error message still comes up.

 

Has anyone had this problem before and if so would you be able to help?

 

Many thanks 

1 ACCEPTED SOLUTION

Hi @RossBateman 

As a workaround, If the column has only number type value, you can change its type from "text" to "number",

Capture7.JPG

Then add "prefix",

Capture8.JPG

Then remove duplicates works.

 

Best Regards

Maggie

Community Support Team _ Maggie Li
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

6 REPLIES 6
amitchandak
Super User
Super User

Create a visual table or matrix, take invoice number and again take invoice and change aggregation to count.

Sort desc on Count of Invoice no. Make sure there is nothing having count more than 1

Thanks, it looks like this is the problem. The remove duplicate function doesnt seem to be romoving all of the rows! As I've got over 55k rows do you know of any other ways to delete duplicates?

 

Hi @RossBateman 

As tested, "remove duplicates" works on my side.

Capture7.JPG

Please share some sample data for me to test and find a solution for you.

 

Best Regards

Maggie

Thanks Maggie. The problem was that some of the invoices were different but werent classed as unique when trying to set up the relationship. For example there was invoice number 003 and 0000003. The remove duplicates didnt class those as the same but when not in the query mode they were classed as the same. 

 

The only way I think I can get around this if I add a letter to the begining of every invoice.

Hi @RossBateman 

As a workaround, If the column has only number type value, you can change its type from "text" to "number",

Capture7.JPG

Then add "prefix",

Capture8.JPG

Then remove duplicates works.

 

Best Regards

Maggie

Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Need help!

I have the same issue when creating the relationship between the tables. 

I have 3 Facts tables:

Table 1: Have columns of "Acad Session", "Modules" and "hours per week for the module"

Table 2: Have columns of "Acad Session",  "Teaching staff" , and "modules staff are teaching"

Table 3: Have columns of "Acad Session",  "Teaching staff" , and "Status, (Active or Retired)" 

Dimension tables for modules are created by duplicating the Table 1 and keep the column  "Modules" first and then remove the duplicate in the column. But I received the error message "You cann't create a relationship between two columns because one of the columns must have unique values" when trying to create the relationship with Table 1.

Same error for creating Dimension table for "Teaching Staff"

Dimension table for Acad Session and Status have no issue (these two dimension tables have few rows only)

 

Thank you in advance for the advice/help

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.