50、Power Query-Text.Contains的学习

比如现在有这样一个需求,需要筛选某列规格里面的一些内容。


比如我们要筛选出包含“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()

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

SAP剑客

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值