Forum Discussion

JoeConradie's avatar
JoeConradie
Regular Visitor
6 years ago
Solved

Add table column that is filtered using a list in first table

Good day everyone I need some assistance in the query editor as I don't know how to get around the problem and couldn't find any posts on the Power BI Community that could guide me in the right dire...
  • Anonymous's avatar
    Anonymous
    6 years ago
    let
        Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("RY65EcAgDMB2cU2BISSkzP+NwFFk/yWinAsK3UmFn1LkVXEygUp1ZEBnCJYRXSBZdugKnWVCtzbboztkywE9IFpm9ARvOaJX26wev9th/f96rOsH", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Id = _t, Name = _t, Value = _t]),
        #"Changed Type" = Table.TransformColumnTypes(Source,{{"Id", type text}, {"Name", type text}, {"Value", Int64.Type}}),
        ac = Table.AddColumn(#"Changed Type", "Filter", each if [Id]="a3" then {"A", "B"} else {"A","C","D"}),
        #"Added Custom" = Table.AddColumn(ac, "tables", each Table.FromRecords(List.Transform([Filter], (f)=> ac{[Name=f]})))
    in
        #"Added Custom"