Expression.Error 枚举中没有足够的元素来完成操作。电量查询
Expression.Error There weren't enough elements in the enumeration to complete the operation. power query
以下是来自 power query (Excel 2016) 的股票代码的 m 代码。
如果我输入正确的股票代码(如 MSFT),它会完美运行,但如果我输入不正确的股票代码(如 ddddddd),我会收到以下错误,“[Expression.Error] 枚举中没有足够的元素来完成操作。”
如何绕过此错误并为值输入 0?
我能以某种方式使用 Try Otherwise 吗?
提前致谢!
(InputTicker as text) as table =>
let
Source = Web.Page(Web.Contents("https://finance.yahoo.com/quote/"&InputTicker&"/key-statistics?p="&InputTicker)),
Data3 = Source{3}[Data],
#"Demoted Headers" = Table.DemoteHeaders(Data3),
#"Filtered Rows" = Table.SelectRows(#"Demoted Headers", each Text.Contains([Column1], "Forward Annual Dividend Yield"))
in
#"Filtered Rows"
尝试
Data3 = try Source{3}[Data] otherwise #table({"First Column", "Second Column"}, {{"Forward Annual Dividend Yield",0}}),
以下是来自 power query (Excel 2016) 的股票代码的 m 代码。 如果我输入正确的股票代码(如 MSFT),它会完美运行,但如果我输入不正确的股票代码(如 ddddddd),我会收到以下错误,“[Expression.Error] 枚举中没有足够的元素来完成操作。” 如何绕过此错误并为值输入 0? 我能以某种方式使用 Try Otherwise 吗?
提前致谢!
(InputTicker as text) as table =>
let
Source = Web.Page(Web.Contents("https://finance.yahoo.com/quote/"&InputTicker&"/key-statistics?p="&InputTicker)),
Data3 = Source{3}[Data],
#"Demoted Headers" = Table.DemoteHeaders(Data3),
#"Filtered Rows" = Table.SelectRows(#"Demoted Headers", each Text.Contains([Column1], "Forward Annual Dividend Yield"))
in
#"Filtered Rows"
尝试
Data3 = try Source{3}[Data] otherwise #table({"First Column", "Second Column"}, {{"Forward Annual Dividend Yield",0}}),