从多个excel表导入power pivot,跳过一些列

时间:2014-11-14 19:37:29

标签: excel powerpivot powerbi

我从另一个excel文件导入了一个power pivot,对于某些行,它会跳过一列并向左移动数据(即进入另一列)

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

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

我尝试从源表中删除这些行(如果它是数据错误),但它只对下一行(相同的计数)执行相同的操作。似乎始终是表格开头的行。

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

有些表只有1行,其中有些行最多有10行。

在所有有问题的表中,这是非常奇怪和相同的问题。如果它是某种正常错误会更好,但将数据放在diff列中是非常奇怪的。

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

----编辑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并重新启动查询=问题解决
  7. 不知道在导致问题的违规行中有什么古怪的格式。

1 个答案:

答案 0 :(得分: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

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