Forum Discussion

strdst2090's avatar
strdst2090
Frequent Visitor
2 years ago
Solved

Extract data using lookup table

I need help refining a function/building a solution from scratch to a PowerBI usecase I have. I have a table that represents journal data. The principle fields are Journal ID, Project Name, Line Des...
  • Ahmedx's avatar
    2 years ago

    pls try this

    let
        S  =  List.Buffer( #"Vendor Table"[Vendor Name]&{""}),
        R  =  List.Buffer( #"Vendor Table"[Normalized Name]&{null}),
        f=(x)=>((a)=>R{List.PositionOf(S,a,0,(c,v)=>Text.Contains(v,Text.Lower(c)))})(Text.Lower(x)),
        Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WcnRydlGK1YlWcnVz9wAzQlKLSwwNTUzNzC3gfEsvzzCXYK8wf6XYWAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Line Description" = _t]),
        #"Changed Type" = Table.TransformColumnTypes(Source,{{"Line Description", type text}}),
        #"Added Custom" = Table.AddColumn(#"Changed Type", "Result", each f([Line Description]))
    
    in
      #"Added Custom"