otk
otk

Reputation: 411

How to make a existing column "unique" in PowerBI, so I can form a "one-to-many" relationsship?

I have 40 tables. One table has 20 rows, and one of the columns have 1385 distinct values. I would like to use this in a relationship with another table.

TableName(1385 rows) Column:Name:(1385 distinct values)

But when I try to do this in Powerbi/Manage-Relations, it will only accept the option "Many-to-Many" relationship. It reports that none of the column are "Unique".

Well, the data in the column is unique. So how can I configure this column to be unique so I can use it in a "One-to-Many" relationship"?

Do I have to edit the DAX expression and put the "DISTINCT" keyword in the expression for that column? And How?

Now I have:

    }, {"Columnname", Int64.Type}, {

Upvotes: 0

Views: 7536

Answers (2)

user11738502
user11738502

Reputation:

what you can try is to perform remove duplicates in that table(i know its already contains distinct values but you can give it a try)... and/or just load the data again.

Upvotes: 2

Strawberryshrub
Strawberryshrub

Reputation: 3389

Best way would be when you group your data in the query editor. This way your table has only distinct values and you can create your relationship.

In the query designer under Home > Group By you can group after your column.

Example

Table:

enter image description here

Table (2):

enter image description here

Relationship (One to Many):

enter image description here

Result:

enter image description here

I hope this helps.

Upvotes: 1

Related Questions