【发布时间】:2021-08-24 17:28:51
【问题描述】:
我需要创建一个新的 DAX 列,该列将从同一个表的另一列中搜索字符串。它将搜索第二个表中的任何值,如果找到任何这些值,则返回 True。简化示例:
假设我有一个名为 Sentences 的表,其中包含 1 列:
Sentences
Col1
----------------
"The aardvark admitted it was wrong"
"The attractive peanut farmer graded the term paper"
"The awning was too tall to touch"
还有一个名为 FindTheseWords 的表,其中包含值列表
FindTheseWords
Col1
----------------
peanut
aardvark
我将在 Sentences 表中创建 Col2,它应该返回
Sentences
Col1 Col2
---------------------------------------------------- ------------------------
"The aardvark admitted it was wrong" TRUE
"The attractive peanut farmer graded the term paper" TRUE
"The awning was too tall to touch" FALSE
FindTheseWords 的列表实际上很长,所以我不能硬编码它们并使用 OR。我需要参考表格。我不关心空格,所以带有“花生”的句子也会返回 true。
我在 M 中看到了一个很好的实现,但是我的负载性能受到了相当大的打击,所以我希望为新列找到一个 DAX 选项。 M方案,供参考:How to search multiple strings in a string?
【问题讨论】:
标签: excel dax powerpivot