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

Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now

Reply
YBZ
Helper III
Helper III

error duplicate value

Hi,

 

I receive suddenly error when loading my tables that there is a duplicate value in one of my tables which is not allowed for a one-to-many relationship.

 

I however checked the table and I cannot find any duplicate value, especially because I put in the query editor to remove all duplicates. 

 

Any idea how I could possibly solve this?

 

Regards

2 ACCEPTED SOLUTIONS
TomMartens
Super User
Super User

Hey @YBZ ,

 

sometimes these errors are based on the fact that there are different spellings, this means that apple and Apple are considered differently by Power Query.

To get rid of this issue I first lowercase or UPPERCASE the value I want to use for the relatioship, then I remove duplicate values.

 

Hopefully, this helps to tackle your challenge.

 

Regards,

Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

View solution in original post

Martin_D
Super User
Super User

Hi @YBZ ,
A popular cause of this is that Power Query is case sensitive whereas DAX by default is not case sensitiv. Thus a remove duplicates step in Power Query might keep values like "name" and "Name" as distinct values wheres the data model considers them duplicates. A remove duplicates step on a text or untyped column in Power Query is in general not an appropriate means to create a unique key column for the datamodel. As a workaround you can duplicate the column that shall contain your unique keys, then transform the copy to all lower case, then remove duplicates on the new column, then remove the new colum again.

If this solution does not relate to the cause of your problem, then a versatile approach to debug the problem is: 

  • create a table visual
  • put the field from the "one" side of your relationship into the first column of the table visual without aggregation
  • put the same field into the second column of the table visual with aggregation "count"
  • sort the table visual by the second column decending

This will show you which values are considered duplicates at the top. This might help you to identify the cause of the problem and solve it.

Cf.:

Power Query after remove duplicates step appears as:

Martin_D_0-1698581600007.png

Is loaded into Power BI as (the first occuring uppercase and lowercase spelling is applied for all duplicate values):

Martin_D_1-1698581641948.png

And appears in the table visual as:

Martin_D_2-1698581672532.png

BR
Martin

github.pnglinkedin.png

View solution in original post

3 REPLIES 3
YBZ
Helper III
Helper III

Thanks both 🙂

thanks to your advice I found that there was a blank space added at one of the values.

 

Martin_D
Super User
Super User

Hi @YBZ ,
A popular cause of this is that Power Query is case sensitive whereas DAX by default is not case sensitiv. Thus a remove duplicates step in Power Query might keep values like "name" and "Name" as distinct values wheres the data model considers them duplicates. A remove duplicates step on a text or untyped column in Power Query is in general not an appropriate means to create a unique key column for the datamodel. As a workaround you can duplicate the column that shall contain your unique keys, then transform the copy to all lower case, then remove duplicates on the new column, then remove the new colum again.

If this solution does not relate to the cause of your problem, then a versatile approach to debug the problem is: 

  • create a table visual
  • put the field from the "one" side of your relationship into the first column of the table visual without aggregation
  • put the same field into the second column of the table visual with aggregation "count"
  • sort the table visual by the second column decending

This will show you which values are considered duplicates at the top. This might help you to identify the cause of the problem and solve it.

Cf.:

Power Query after remove duplicates step appears as:

Martin_D_0-1698581600007.png

Is loaded into Power BI as (the first occuring uppercase and lowercase spelling is applied for all duplicate values):

Martin_D_1-1698581641948.png

And appears in the table visual as:

Martin_D_2-1698581672532.png

BR
Martin

github.pnglinkedin.png

TomMartens
Super User
Super User

Hey @YBZ ,

 

sometimes these errors are based on the fact that there are different spellings, this means that apple and Apple are considered differently by Power Query.

To get rid of this issue I first lowercase or UPPERCASE the value I want to use for the relatioship, then I remove duplicate values.

 

Hopefully, this helps to tackle your challenge.

 

Regards,

Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

Helpful resources

Announcements
OCT PBI Update Carousel

Power BI Monthly Update - October 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

October NL Carousel

Fabric Community Update - October 2024

Find out what's new and trending in the Fabric Community.