English 中文(简体)
在动力学中,如何找到一份与案文不符的案文?
原标题:In Powerquery how can i find a text that is not an exact match?
  • 时间:2024-02-18 00:30:20
  •  标签:
  • powerquery

我有以下公式可操作并找到与“1EA”的确切匹配。

= List.Select(ColumnNames, each List.Contains(Table.Column(#"Filled Down",_),"1 EA"))

然而,我想加以修改,以便在案文中找到“1EA”。 换言之,如果存在案文或白色空间,则仍然会恢复真实。

我已审判了查塔戈临时法院,但没有工作。

= List.Select(ColumnNames, each List.AnyTrue(List.Transform(Table.Column(#"Filled Down", _), each Text.Contains(_, "1 EA"))))

以上一有错误。 但是,除了显示一个实际上包含“1EA”案文的单列名称外,没有说明错误。

= List.Select(ColumnNames, each List.Contains(Table.Column(#"Filled Down", _), each Text.Contains(_, "1 EA")))

以上是一份空洞清单,也是没有意义的。

我的数据如下: 在以下假设情景中,预计数据将汇回。

Data.Column1 Data.Column2 Data.Column3 Data.Column4
Sample Text 1 EAsdd Sample text 1 EA
1 EA Sample text Sample Text 1 EAff
最佳回答

根据您的数据,以下各栏将重新编号1EA。 请注意,只有第2栏载有这一案文。 如果您希望交回第1、2和4栏,将需要测试<代码>1EA。 此外,正如我在本法典中所显示的那样:

let
    Source = Excel.CurrentWorkbook(){[Name="Table9"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{
        {"Data.Column1", type text}, {"Data.Column2", type text}, {"Data.Column3", type text}, {"Data.Column4", type text}}),

    #"Columns with 1EA" = 
        List.Accumulate(
           Table.ColumnNames(#"Changed Type"),
            {},
            (s,c)=> if List.AnyTrue(List.Transform(Table.Column(#"Changed Type",c), each 
                Text.Contains(_,"1 EA") or Text.Contains(_, "1EA")))
                        then s & {c} else s)
    
in
    #"Columns with 1EA"

Data
enter image description here

Results
enter image description here

*Edit:
。 根据您翻译的<代码>1EA =>1EA的最新数据,你只得修改该代码,删除1EA的测试。

...
    #"Columns with 1EA" = 
        List.Accumulate(
           Table.ColumnNames(#"Changed Type"),
            {},
            (s,c)=> if List.AnyTrue(List.Transform(Table.Column(#"Changed Type",c), each 
                Text.Contains(_,"1 EA") ))
                        then s & {c} else s)
...
问题回答

引证。

= List.Select(ColumnNames, each Text.Contains(_, "1 EA",Comparer.OrdinalIgnoreCase))




相关问题
PowerQuery Custom Function: column value in set of numbers

I am brand new to PowerQuery. I want to make a custom column with a value of 1 if the column value is in a set of numbers (e.g., 3,6,9,14) and 0 otherwise. Besides a big if statement for all the ...

Issue Looping Through an entire list in power query

I am pulling data from the internet right now and formatting it into a readable list using power query, but I am running into an issue. When I split the columns into rows (as I have to change the data ...

Power BI Subtotal Measure

I need your help with some Power Bi code As you can see, in the Excel Worksheet i have 2 cells (yellow) that are mainly of subtotals and 2 columns (last 2) that depends of these subtotals, however ...

热门标签