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
Anonymous
Not applicable

PowerBI Double Counting my data

When I import data from a folder containing multiple excel documents it is double counting my data. So in other threads this has been said to be a rare bug but it happens to me almost everytime I get data from a folder. Why does this happen? It is doublecounting at the powerquery step and all subsequent power bi visuals will show the inflated data.

 

I have monkeyed around with the source data quite a bit and found that if I copy the data to a new excel file, delete the original, and refresh then I will get the correct numbers but what is causing it to happen to begin with?

 

Here is my PowerQuery:

 

let
Source = Folder.Files("C:\Users\User\Desktop\FolderName"),
#"Removed Other Columns" = Table.SelectColumns(Source,{"Content"}),
#"Added Custom" = Table.AddColumn(#"Removed Other Columns", "GetData", each Excel.Workbook([Content])),
#"Removed Columns" = Table.RemoveColumns(#"Added Custom",{"Content"}),
#"Expanded GetData" = Table.ExpandTableColumn(#"Removed Columns", "GetData", {"Name", "Data", "Item", "Kind", "Hidden"}, {"GetData.Name", "GetData.Data", "GetData.Item", "GetData.Kind", "GetData.Hidden"}),
#"Added Custom1" = Table.AddColumn(#"Expanded GetData", "NoHeaders", each Table.PromoteHeaders([GetData.Data])),
#"Removed Other Columns1" = Table.SelectColumns(#"Added Custom1",{"NoHeaders"}),
#"Expanded NoHeaders" = Table.ExpandTableColumn(#"Removed Other Columns1", "NoHeaders", {"Name", "Type", "Name", "Customer Name", "Serial Number", "Part Number", "Invoice Date", "Points Earned", "Last Point Update", "Industry", "Brand"}, {"Name", "Type", "Name", "Customer Name", "Serial Number", "Part Number", "Invoice Date", "Points Earned", "Last Point Update", "Industry", "Brand"}),
#"Changed Type" = Table.TransformColumnTypes(#"Expanded NoHeaders",{{"Points Earned", Int64.Type}, {"Last Point Update", type datetime}, {"Invoice Date", type datetime}})
in
#"Changed Type"

1 ACCEPTED SOLUTION
Anonymous
Not applicable

@Anonymous,

After you connecting to the folder in Power BI Desktop, why not directly expand the content column to get combined data of all excel files?
1.PNG

In your scenario, if you create table in a Excel sheet , Power BI will double count data((both sheet data and table table)) using the above power query code.

Regards,
Lydia

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

@Anonymous,

After you connecting to the folder in Power BI Desktop, why not directly expand the content column to get combined data of all excel files?
1.PNG

In your scenario, if you create table in a Excel sheet , Power BI will double count data((both sheet data and table table)) using the above power query code.

Regards,
Lydia

Anonymous
Not applicable

Seems to work pretty well. My orginal solution was created after watching this video:

 

https://www.youtube.com/watch?v=a7E29H5ZUmE 

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.