Forum Discussion
Can´t create a relationship between two columns because one of the columns must have unique value
- 10 years ago
KSveigaard basically what that error is complaining about is that relationship you're trying to create from column within 'FROM' table to your column in 'TO' table has issue. one of that column must have unique product numbers. you can't have Many to Many relation but only One to Many or Many to One relation. So ensure that one of the table has unique product numbers and then there won't be any issue.
I still can't see how my values are not distinct but I have managed to get this to work by creating a calculated table and creating the relationship from there
Lookuptable = DISTINCT(table[column])
In case it's helpful to anyone...
Today I realized that the Filter funtion inM/Power Query doesn't easily combine AND and OR statements. My issue resolved when I separated this into it's own query step (I was trying to build a relationship on a field called [TUID__c]:
#"FilterTUID"= Table.SelectRows(Contact1, each [TUID__c] <> "" and [TUID__c] <> null),
It was previously part of one big filter step with this other filtering, which obviously doesn't work, because the OR statement just works on whatever it's next to:
#"FilterUnit"= Table.SelectRows(FilterTUID, each [Unit__c] = "CURRENT" or [Unit__c] = "ALUM"),
I also learned that removing duplicates alone will not kill a null value, and that the null value will still generate the "duplicates" error when creating a relationship (as weird and stupid as that sounds - it basically doesn't count the null as a distinct value, yet it counts it as a value, or something...). So, if you have a single null, this query step is useless:
#"Removed Duplicates" = Table.Distinct(#"Changed Type", {"TUID__c"})