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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

Duplicates after importing a Table from PostgreSQL DB [Power BI Desktop]

Hi,

Issue with Power Query on Power BI Desktop (February 2022) potentially creating a few duplicates when importing a large Table from a PostgreSQL database.

- Imported a Table called "s_tache" from a PostgreSQL database :
power_query_import.png

- Distribution indicates duplicates in the Primary Key ("tae_id") field. Unique values does not match Number of values :
power_query_duplicate.png

- Checking the source database with a SQL query. "tae_id" is indeed the primary key and does not countain duplicates (Yes, my name is Captain Obvious. How could you tell?)
SQL_query.png

- Deleting rows works. No more duplicates in the Primary Key field :
power_query_duplicate_delete.png

- Keep Rows > Keep duplicates DOES NOT return any row (???):

power_query_duplicate_keep.png

How does that happen? Is it a bug? Not making any sense to me but I could be missing something.

 

Edit : Reported the issue in the appropriate section

https://community.powerbi.com/t5/Issues/Power-Query-showing-quot-ghost-quot-duplicates-in-Profil-Vie...

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Fixed the issue by using a NativeQuery :

BastienC_0-1646221063416.png

 

View solution in original post

5 REPLIES 5
simonthomas
New Member

I was struggling with the same issue:  I can confirm it is not simply a visual bug, I had a filter applied after that gave a lot of false positives because of the duplicates. Native query seems to have fixed it.

Thank you so much for your help!!

Anonymous
Not applicable

Fixed the issue by using a NativeQuery :

BastienC_0-1646221063416.png

 

v-jingzhang
Community Support
Community Support

Hi @Anonymous 

 

Glad it works in the report.

 

It looks weird. Not sure if there is issue in the column profile view. From the first screenshot, the id 4457 is considered to appear in two rows by Power Query. You could try filtering the tae_id column to show only rows that tae_id equals 4457 and check whether the filtered result have one or two rows. 

vjingzhang_0-1646018257387.png

 

Best Regards,
Community Support Team _ Jing

Anonymous
Not applicable

Hi Jing,
Thanks for considering my issue. After filtering [tae_id] = 4457 only a single row comes up. 

tae_id_filtered.pngThis really looks like a bug with the profile view. But then, what could Power Query be deleting when targeting duplicates? Really odd.

On top of that, my DAX measures are slightly off the expected results given by SQL queries. However, the data structure was heavily manipulated and the DAX queries are relatively complex. Mistakes could be on my part but with this little bug it's hard to be sure. 

Anonymous
Not applicable

This seems to be a visual bug. Duplicates are nowhere to be seen after applying Power Query (without deleting duplicates ofc) and relations "1 to many" related to the field work just fine. Distribution is probably borking a little when the table is too large. Had issues further down the line with my PK not being unique for relations but it could be due to something else.
Will report back if anything new or interesting happens about the subject.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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 Kudoed Authors