在电源查询中使用文本(sub)字符串查找某些代码组合
我有类似的问题(下面的链接),但它只是让我对我在路上发现的问题说“附加”。
我需要的是使用子字符串作为查找来提取一个字符串中的精确匹配项(或者我会说 Power Query 中的模糊匹配项)。
(请忽略屏幕截图和数据中的 T1 和 T2)
正如您在表 3 中看到的(T3)是主字符串,T4 中是标记略有不同的子字符串(例如 JH 而不是 JH0 或否则..)这正是我所需要的,按原样使用子字符串,但过滤掉主字符串并获取 T5 中的结果。
我在 Power Query 中使用模糊匹配尝试了运气,但问题是之后当我有更多实例的不同子字符串时,我的查询由于“列不存在等等......它必须是动态的”而失败。
我想在 Power Query 中找到解决方案!
I had similar question (link below), but it just lets say "add-on" to my issue that I found on the way.
Find all code combinations using text string in Power Query
What I need is to extract exact matches (or I would say fuzzy matches in Power Query) that are in one string using substring as lookup.
(Please ignore T1 and T2 in the screenshot and data)
As you can see in Table 3 (T3) is a main string, and in T4 is substring with slightly different markings (like JH instead of JH0 or else..) Thats exactly what I need, to use substring as it is but to filter out main string and get results as they are in T5.
I tried my luck using Fuzzy matching in Power Query but the problem is afterwards when I have different substring with more instances, my query is failing due to "column doesn't exist and so on...it has to be dynamic.
I would like to have solution in Power Query!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
它在做什么 (a) 在 a 或 _ 处将 table3 拆分为一个列表 (b) 复制 A 中的列表并删除所有数字 (c) 在每个 _ 处将 table4 拆分为一个列表 (d) 将 c 中的每个值与b.如果存在匹配,则使用该位置编号从 a 中提取值,否则输入“missing”(e) 将结果用逗号分隔放回一起
根据评论,备用版本适用于来自的多个匹配表3:
what it is doing (a) split table3 into a list at either a , or _ (b) duplicate the list from A and remove all numbers (c) split table4 into a list at each _ (d) match each value from c against b. If there is a match, use that position number to pull the value from a, otherwise put "missing" (e) put the results back together with a comma separation
Per comments, alternate version that works for multiple matches from Table3: