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
vgeldbr
Helper IV
Helper IV

Power Query import of CSV file creates duplicate rows

I have a CSV file with just over 13,000 rows. It is an export from a system and is stored in a SharePoint library from where Power BI imports it. The query looks like this:

let
  Source = SharePoint.Files("https://sites.company.com/sites/sitename", [ApiVersion = 15]),
  #"Filtered Rows" = Table.SelectRows(Source, each [Folder Path] = "https://sites.company.com/sites/sitename/foldername/subfoldername/"),
  #"Filtered Rows1" = Table.SelectRows(#"Filtered Rows", each Text.StartsWith([Name], "FileName.csv")),
  Navigation = #"Filtered Rows1"{[Name = "FileName.csv", #"Folder Path" = "https://sites.company.com/sites/sitename/foldername/subfoldername/"]}[Content],
  #"Imported CSV" = Csv.Document(Navigation, [Delimiter = ",", QuoteStyle = QuoteStyle.Csv]),
  #"Promoted headers" = Table.PromoteHeaders(#"Imported CSV", [PromoteAllScalars = true])
in
#"Promoted headers"

The CSV file has no duplicate records (based on column [Instance ID] but when Power Query important it the rows are duplicated.

I've spent time googling this and duplicate rows from CSV imports seems to happen a lot not just in Powe Query but I've not found any solution or reason.

 

If I save just the header row and a single row in a new CSV file this does not happen. Note the issue happens both in Power Query Online (dataflow) and Power BI desktop (December 2023 release).

 

Does anybody have any ideas? Unfortunately I cannot share the CSV file.

 

1 REPLY 1
Fowmy
Super User
Super User

@vgeldbr 

Not sure how it happens without having a look at your query and debug. You can apply one more step to remove duplicates

Table.Distinct(#"Promoted headers", {"Instance ID"})
Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.