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

StackOverflow https://stackoverflow.com/questions/20530532

  •  31-08-2022
  •  | 
  •  

Domanda

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)

È stato utile?

Soluzione

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.

Altri suggerimenti

Same issue VS 2010, SSAS 2012 resolved:

  1. Switch model to manual calculation (Model menu)
  2. Add a calculated column to table with troubled unique column
  3. Under Model menu click calculate now
  4. In original unique column set property "Row Identifier" to True (Click on column then F4)
  5. Delete calculated column created in #2

This worked for me after close-->open project and delete-->add table failed.

There is just something with tabular that hates developers ...

just encountered the same issue. Added dimension table with unique keys to the model and linked it to first fact table.

After that, tried to link to second fact table with exact the same error.

Figured out how to bypass the issue. Do step 1, save and close the model. Reopen the model and create link to second fact. Worked fine for me. After that, I could even create a link to a third fact table without even closing it before. Weird.

Hope that works for you.

Cheers

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top