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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

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
Solution Sage
Solution Sage

 

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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors