我知道有关于此错误的主题,但是我已经对其进行了审查,但它们没有帮助。我正在尝试添加具有“金额”列的绝对值的自定义列。
步骤1:
第2步(导致错误):
基于其他线程,这似乎是一个错字,但是,这里似乎不是这样。另外,我有4个类似的Excel文件,它们以相同的步骤导入-2个工作文件,2个不行。
有很多想法。
编辑: 这是高级编辑器中的完整代码
let
Source = SharePoint.Files("https://netorgftxxxxxx.sharepoint.com/", [ApiVersion = 15]),
#"Filtered Rows" = Table.SelectRows(Source, each Text.Contains([Folder Path], "FName LName")),
#"Filtered Rows5" = Table.SelectRows(#"Filtered Rows", each ([Name] <> "2019-07-29T08_13_08+00_00Customer_List.xlsx" and [Name] <> "2019-07-29T08_13_08+00_00Invoice_Listing_TTM.xlsx" and [Name] <> "2019-07-29T08_13_08+00_00Revenue_by_Customer_for_Dashboard.xlsx")),
#"Filtered Rows2" = Table.SelectRows(#"Filtered Rows5", each Text.Contains([Name], "Company")),
#"Changed Type" = Table.TransformColumnTypes(#"Filtered Rows2",{{"Date modified", type date}}),
#"Filtered Rows1" = Table.SelectRows(#"Changed Type", let latest = List.Max(#"Changed Type"[Date modified]) in each [Date modified] = latest),
#"Filtered Rows3" = Table.SelectRows(#"Filtered Rows1", each Text.Contains([Name], "Expense")),
#"Removed Other Columns" = Table.SelectColumns(#"Filtered Rows3",{"Content"}),
Content = #"Removed Other Columns"{0}[Content],
#"Imported Excel" = Excel.Workbook(Content),
#"Removed Other Columns1" = Table.SelectColumns(#"Imported Excel",{"Data"}),
Data = #"Removed Other Columns1"{0}[Data],
#"Removed Columns" = Table.RemoveColumns(Data,{"Column1"}),
#"Removed Top Rows" = Table.Skip(#"Removed Columns",4),
#"Promoted Headers" = Table.PromoteHeaders(#"Removed Top Rows", [PromoteAllScalars=true]),
#"Added Custom" = Table.AddColumn(#"Promoted Headers", "Custom", each "Company"),
#"Filtered Rows4" = Table.SelectRows(#"Added Custom", each ([Transaction Type] = "Bill" or [Transaction Type] = "Expense")),
#"Changed Type1" = Table.TransformColumnTypes(#"Filtered Rows4",{{"Amount", type number}}),
#"Added Custom1" = Table.AddColumn(#"Changed Type1", "Adjusted Expense Amount", each Number.Abs([Amount]))
in
#"Added Custom1"
答案 0 :(得分:0)
我猜您在Amount
列中有值,当您使用Abs()
函数时会抛出错误。当列中有文字时,可能会发生这种情况,因为Abs()
functino需要数字类型的格式。
您可以先清理Amount
列(这样就只有数字格式),或者在M表达式中添加其他检查。
例如:
= if Value.Is(Value.FromText([Column1]), type number)
then Number.Abs(Number.From([Column1]))
else null
答案 1 :(得分:0)
应为以下情况之一:
答案 2 :(得分:0)
事实证明,问题出在代码的第8行,它不够具体。两种类型的文件正在导入,从而导致错误。感谢大家的帮助!