SAP 剑客
于 2017-02-28 16:51:40 发布
10096
收藏 10
版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
比如现在有这样一个需求,需要筛选某列规格里面的一些内容。
比如我们要筛选出包含 “110” 以及 “123” 以及 “CF” 的规格,当然用条件格式也是可以的。
若是两个包含,我们可以直接筛选得到,如下图操作。
没错,就是文本筛选器里面的 “包含”。
那么最后一个条件该如何引入呢?
我们不妨直接看它生成的公式,是不是豁然开朗?
\= Table.SelectRows(更改的类型, each Text.Contains([型号], “110”) or Text.Contains([型号], “123”))
直接添加 “OR” 即可。
\= Table.SelectRows(更改的类型, each Text.Contains([型号], “110”) or Text.Contains([型号], “123”) or Text.Contains([型号], “CF”))
那么我们就来看看这个好用的 Text.Contains() 函数。
This topic applies to the Power Query Formula Language which can be used with Power Query and Power BI Desktop to build queries that mashup data. See the list of function categories.
Returns true if a text value substring was found within a text value string; otherwise, false.
Text.Contains(string as nullable text, substring as text, optional comparer as nullable function) as nullable logical
Argument | Description |
---|---|
string | The text to parse. |
substring | The text to search for. |
optional comparer | The optional culture aware comparer function can be provided. |
简单例子:
Text.Contains(“abc”, “a”) equals true
Text.Contains(“abc”, “d”) equals false
清楚了这个函数的用法,当然 “开头为” 和“结束为”也大同小异啦。
Text.StartsWith()
Text.EndsWith()
https://saper.blog.csdn.net/article/details/58604081