0

我有一个从另一个 excel 文件导入的 power pivot ,对于某些行跳过一列并将数据向左移动(即到不同的列)

电源透视查询设置为 1) 读取 excel 文件中的所有表(30-50 个表) 2) 根据表名过滤表 3) 通过插入和扩展列名将它们组合成一个大表。

这些表都有相似的列,2400 行有效,但 82 行显示为错误。在错误行上,它会跳过一列,并将数据放在大约 12 个表的右左一列,大约 6 列。

我已经尝试从源表中删除这些行(以防它是数据错误),但它只是对下一行做同样的事情(相同的计数)。似乎总是在表的开头行。

我试过重命名表,重新创建表,删除表中的所有数据。并且相同的行一直没有被导入。我可以单独导入表格而不会出错。我已经重建了

有些表只有 1 行,而有些表最多有 10 行。

在所有有问题的表中,这真的很奇怪而且同样的问题。如果这是某种正常错误会更好,但是将数据放在差异列中是非常奇怪的。

是的,我应该使用数据库,但 excel 和电源查询应该是一个快速而肮脏的概念证明。

----编辑 11 月 17 日 ---

这是我的电源查询,我将按照建议检查上面的行是否有错误并报告回来。

let
Source = Excel.Workbook(File.Contents("P:\Daily Truck Sheet\TimeTrack\testing\Copy of TimeTrack.xlsm")),
#"Filtered Rows" = Table.SelectRows(Source, each Text.StartsWith([Name], "p2014")),
#"Sorted Rows" = Table.Sort(#"Filtered Rows",{{"Name", Order.Descending}}),
#"Added Custom" = Table.AddColumn(#"Sorted Rows", "Custom", each pleasework2 ([Name])),
#"Expand Custom" = Table.ExpandTableColumn(#"Added Custom", "Custom", {"Description", "ClientCode", "Qty", "UOM", "Total", "FieldA", "FieldB", "project", "Unit Price", "tc/Ref", "EE", "Hours", "QTYcompleted", "Started", "Finished", "Complete","STREET ADDRESS","STREET NAME","City","CONDUIT / DROP / STREET CROSSING?","LENGTH OF CONDUIT","LENGTH OF DROP","DATE PRE-FIELDED","AS BUILTS / PICS RECEIVED","DATE COPIED TO CD"}, {"Description", "ClientCode", "Qty", "UOM", "Total", "FieldA", "FieldB", "project", "Unit Price", "tc/Ref", "EE", "Hours", "QTYcompleted", "Started", "Finished", "Complete","STREET ADDRESS","STREET NAME","City","CONDUIT / DROP / STREET CROSSING?","LENGTH OF CONDUIT","LENGTH OF DROP","DATE PRE-FIELDED","AS BUILTS / PICS RECEIVED","DATE COPIED TO CD"}),
#"Removed Columns" = Table.RemoveColumns(#"Expand Custom",{"Name", "Kind", "project", "Data"}),
#"Added Custom1" = Table.AddColumn(#"Removed Columns", "Estimated Hours", each [Total]/75),
Rounding = Table.TransformColumns(#"Added Custom1",{{"Estimated Hours", each Number.Round(_, 2)}}),
#"Added Custom2" = Table.AddColumn(Rounding, "Hours % Complete", each [Hours]/[Estimated Hours]),
#"Added Custom3" = Table.AddColumn(#"Added Custom2", "QTY % Complete", each [QTYcompleted]/[Qty])

在 #"添加了 Custom3"

------11 月 18 日-----这解决了问题------

  1. 我从导致问题的表的所有行中复制了数据
  2. 将值粘贴到表格之外
  3. 使用 ctrl 删除表的所有行 - (因此表中只有一个空行)
  4. 保存的工作簿
  5. 将值复制并粘贴到表中,让 excel 将行插入表中
  6. 保存 xls 并重新运行电源查询 = 问题已解决

不知道导致问题的有问题的行中有什么古怪的格式。

4

1 回答 1

0

------11 月 18 日-----这解决了问题------

I copied the data out of ALL the rows of the tables that were causing problems
pasted the values outside of the table
deleted all the rows of the table using ctrl - (so the table only had one empty row in it)
saved workbook
copied and pasted values into the table letting excel insert the rows into the table
saved xls and reran power query = problem solved

不知道导致问题的有问题的行中有什么古怪的格式。

于 2014-11-18T18:10:49.803 回答