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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
DmitryKo
Helper IV
Helper IV

"Remove duplicates" in M not working?

A simple table with one column set to use as a dictionary.
Table's last transformation step is "remove duplicates".


Yet when trying to set the only column in the table - which should contain only unique values now - as a key column, the following error occurs:

DmitryKo_0-1698850149522.png

 

How come it "doesn't have unique values" when last transformation step is exactly "remove duplicates"? This also makes it impossible to set up relationships properly, as engine thinks table having duplicates

Specific M code is autogenerated as = Table.Distinct(#"Removed Errors")


Edit: just got a repro on this manually entered table consisting of two rows:

DmitryKo_0-1698851604733.png

It seems that the thing just isn't case-sensitive. Why?

5 REPLIES 5
watkinnc
Super User
Super User

Yeah, for the purpose of relationships, those are the same value. Happens to me as well with keys that end in "A" vs "a". You could Text.Uppercase the column before removing duplicates, but if you need both the uppercase and lowercase in your key, you are out of luck--you'll have to change it to something like "uat1".

 

--Nate


I’m usually answering from my phone, which means the results are visualized only in my mind. You’ll need to use my answer to know that it works—but it will work!!

This is definitely a bug in the product. Or a really poor design, which is essentially the same bug.

If you Distinct() it, it should be distinct - for all portions of the product, including relationships.

Any ETA for this bug to be fixed?

slorin
Super User
Super User

Hi

 

= Table.Distinct(#"Removed Errors", Comparer.OrdinalIgnoreCase)

Stéphane 

Not a solution. Data is case-sensitive; can't just ignore it.

What is even worse here, is tool's inconsistent behavior.

"Ignoring Duplicates" through the UI does not provide you any options such as wherever to ignore or not - it just generates the code for Table.Distinct that IS case-sensitive (which is correct). But then using the same autogenerated code should not cause issues when trying to define a table key and/or set up relationships.

Whichever (case-sensitivity) logic is used by the tool when defining dinstinctivity should be re-used by the same tool when defining ability or inability to use the same column as a key or in relationships.

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors
Top Kudoed Authors