Forum Discussion

TLGemp's avatar
TLGemp
New Member
2 years ago
Solved

Use List entry in Table.SelectRows function

Hello everybody.   I have a problem in using a List as argument for a column/record in the function Table.SelectRows.   From my source I got TABLE where one COLUMN, eg. Column3, contains all nece...
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi TLGemp,

    Here is query table code that I used to transform table structure based on 'transpose table' and 'remove blank row' functions to output expected table structure without specific column names as conditions, you can try it if helps:

    let
        Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WUtKBoVgdLLyU1GJDiEhZYo4hkqgRXNQISdQYLmqsFBsLAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t, Column2 = _t, Column3 = _t, Column4 = _t]),
        #"Removed Blank Rows" = Table.SelectRows(Source, each not List.IsEmpty(List.RemoveMatchingItems(Record.FieldValues(_), {"", null}))),
        #"Transposed Table" = Table.Transpose(#"Removed Blank Rows"),
        #"Removed Blank Rows1" = Table.SelectRows(#"Transposed Table", each not List.IsEmpty(List.RemoveMatchingItems(Record.FieldValues(_), {"", null}))),
        #"Promoted Headers" = Table.PromoteHeaders(#"Removed Blank Rows1", [PromoteAllScalars=true]),
        #"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"des1", type text}, {"des2", type text}, {"des3", type text}})
    in
        #"Changed Type"

    Regards,

    Xiaoxin Sheng