简体   繁体   English

Expression.Error:我们无法将值(函数)转换为逻辑类型

[英]Expression.Error: We cannot convert the value (Function) to type Logical

I am trying to apply a user's manually input fields as a filter to data connection (called IKX).我正在尝试将用户的手动输入字段用作数据连接(称为 IKX)的过滤器。

Here is an example of the user input data:以下是用户输入数据的示例:

BUYER CODE FILTER买家代码过滤器
104 104
800 800

I have a table that applies the code format of the power query filter:我有一个表格,它应用了 power query 过滤器的代码格式:

BUYER CODE FILTER FORMAT买家代码过滤器格式 FORMULA公式
[BUYER_CODE] = 104 [BUYER_CODE] = 104 IFERROR(IF(LEN(InputBuyerCodes[@[Buyer Code Filter]])>0, "[BUYER_CODE] = " &InputBuyerCodes[@[Buyer Code Filter]], ""),"") IFERROR(IF(LEN(InputBuyerCodes[@[买家代码过滤器]])>0, "[BUYER_CODE] = " &InputBuyerCodes[@[买家代码过滤器]], ""),"")
or [BUYER_CODE] = 800或 [BUYER_CODE] = 800 IFERROR(IF(LEN(InputBuyerCodes[@[Buyer Code Filter]])>0, " or [BUYER_CODE] = " &InputBuyerCodes[@[Buyer Code Filter]], ""),"") IFERROR(IF(LEN(InputBuyerCodes[@[Buyer Code Filter]])>0, " or [BUYER_CODE] = " &InputBuyerCodes[@[Buyer Code Filter]], ""),"")

Then a table that concats these fields:然后是一个连接这些字段的表:

CONCAT BUYER CODE FILTER FORMAT CONCAT 买家代码过滤器格式 FORMULA公式
[BUYER_CODE] = 104 or [BUYER_CODE] = 800 [BUYER_CODE] = 104 或 [BUYER_CODE] = 800 CONCAT(Table2[Buyer Code Filter Format]) CONCAT(表2[买家代码过滤格式])

In power query I have a connection to the "CONCAT BUYER CODE FILTER FORMAT" table that drills down the table to just [BUYER_CODE] = 104 or [BUYER_CODE] = 800 called ConcatBuyerCodeFilterFormat在电源查询中,我连接到“CONCAT BUYER CODE FILTER FORMAT”表,该表向下钻取到 [BUYER_CODE] = 104 或 [BUYER_CODE] = 800,称为 ConcatBuyerCodeFilterFormat

To apply the filter to the IKX data, I added the below step:为了将过滤器应用于 IKX 数据,我添加了以下步骤:
=Table.SelectRows(Source, each (ConcatBuyerCodeFilterFormat) ) =Table.SelectRows(来源,每个(ConcatBuyerCodeFilterFormat))

and get the error并得到错误
Expression.Error: We cannot convert the value "[BUYER_CODE] = 104 o..." to type Logical. Expression.Error:我们无法将值“[BUYER_CODE] = 104 o...”转换为逻辑类型。 Details: Value=[BUYER_CODE] = 104 or [BUYER_CODE] = 800 Type=[Type]详细信息:Value=[BUYER_CODE] = 104 或 [BUYER_CODE] = 800 Type=[Type]

Any ideas on how to resolve?关于如何解决的任何想法?

See if this helps you.看看这是否对您有帮助。 It shows how to filter, with the filter definition in another variable它显示了如何使用另一个变量中的过滤器定义进行过滤

let Source =#table({"Column1"}, {{"a"}, {"b"}, {"c"}}),
crit="[Column1] = ""a""",
#"Filtered Rows" = Table.SelectRows(Source, Expression.Evaluate("each "&crit))
in #"Filtered Rows"

All that said, if you start off with the first filter table, why not just merge that against your larger data.table and remove the rows with no match?综上所述,如果您从第一个过滤表开始,为什么不将其与更大的 data.table 合并并删除不匹配的行呢?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Expression.Error:我们无法将 null 值转换为 Text 类型。 详细信息:值= 类型=类型 - Expression.Error: We cannot convert the value null to type Text. Details: Value= Type=Type Expression.Error:我们不能将运算符 &lt; 应用于 Function 和 Number 类型 - Expression.Error: We cannot apply operator < to types Function and Number Expression.Error:我们不能将运算符 &amp; 应用于数字和数字类型 - Expression.Error: We cannot apply operator & to types Number and Number Expression.Error:我们不能将运算符 > 应用于类型 List 和 Number - Expression.Error: We cannot apply operator > to types List and Number Excel [Expression.Error] 我们不能将运算符 &lt; 应用于文本和日期类型 - Excel [Expression.Error] We cannot apply operator < to types Text and Date 为什么对上一行中的值的引用会抛出此Expression.Error? - Why does a reference to a value in previous row throw this Expression.Error? Expression.Error: 2 arguments 传递给 function 期望 1 - Expression.Error: 2 arguments were passed to a function which expects 1 Expression.Error电源查询EXCEL - Expression.Error Power Query EXCEL Power Query Expression.Error:日期值必须包含日期组件。 详细信息:43831 - Power Query Expression.Error: The Date value must contain the Date component. Details: 43831 Expression.Error 找不到记录的字段“xxxx” - Expression.Error The field 'xxxx' of the record wasn't found
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM