Search code examples
ssastabular

Error creating SSAS Tabular relationship - "each column contains duplicates" - when one column is primary key


I'm working on an SSAS Tabular project.

I've got a table Sales and Department, tied by DepartmentId.

I had an existing relationship between the two in Design view. While doing some work I deleted the relationship, and now whenever I try to re-create it I get

The relationship cannot be created because each column contains duplicate values. Select at least one column that contains only unique values.

I try to create the relationship by dragging DepartmentId from the Sales table to DepartmentId in the Department table.

The DepartmentId column is the PK for Department. There is no way that column can have duplicates. The table is processed and the data is up to date. The grid view shows the same number of rows as actually exist in the database. The Department-side column has the property Row Identifier in SSAS (which means that even SSAS recognizes that the values are unique).

Again, the relationship has existed and worked fine (and still exists and works fine in the currently deployed version). Only after deleting it can I not add it again (and I actually need to change the relationship so I need to find the cause rather than just reverting to an earlier version in scm)


Solution

  • Deleting and re-adding the table with the unique keys fixed the problem. Fortunately there weren't too many measures to have to re-add.