Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
RVBIBS
Regular Visitor

Duplicate value error

Hej,

 

I have a issue with my data when i try to refresh.

I get the error code

"Column 'Day shift made' in Table 'Print machine' contains a duplicate value '0' and this is not allowed for columns on the one side of a many-to-one relationship or for columns that are used as the primary key of a table."

 

This is my table:

RVBIBS_0-1678096609756.png

 

How can i change so it's allowed to have duplicates? In my data there will be duplicated numbers.

1 ACCEPTED SOLUTION

I changed a lot of the relationsships, so i only looked at the date. There was also some weird going on, it has been made some relationsships which shouldnt exist.

Cleaned it all up and did the relationsships all over - Did the job

View solution in original post

3 REPLIES 3
MAwwad
Super User
Super User

 

To allow duplicate values in the 'Day shift made' column, you can remove the relationship with the table where it is used as the primary key. However, this may affect the accuracy of your data, so you should consider whether it is necessary to maintain the relationship.

If you still want to maintain the relationship and allow duplicate values, you can create a new column in the 'Print machine' table that generates unique values for each row, such as a row number or a GUID. You can then use this column as the primary key instead of the 'Day shift made' column.

To create a row number column, you can use the following DAX formula:

 

 
RowNumber = RANKX(ALL('Print machine'), [Day shift made])
 

This formula ranks the rows in the 'Print machine' table based on the 'Day shift made' column, and generates a unique number for each row.

Alternatively, to create a GUID column, you can use the following DAX formula:

 

 
GUID = GUID()
 

This formula generates a unique GUID value for each row in the table.

After you have created the new column, you can use it as the primary key for the table and maintain the relationship with other tables without encountering the duplicate value error.

The thing i don't understand, is that my date should be my primary key?

How can i see the primary key, and change it for the dates?

I changed a lot of the relationsships, so i only looked at the date. There was also some weird going on, it has been made some relationsships which shouldnt exist.

Cleaned it all up and did the relationsships all over - Did the job

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.

Top Solution Authors
Top Kudoed Authors