Forum Discussion
dslForPBI
8 years agoHelper I
M language issue
OK..this makes no sense to me..I am trying to take a list of numbers and use them as part of a "List.Contains" for a filter...if I hardcode the number list as in: each List.Contains({1,2,3... ...
Greg_Deckler
8 years agoCommunity Champion
I did come up with this, not sure if it helps you or not though. But, I end up with a List of values:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("FYmxDQAgCMB+cS6JCKjcYvz/DXFpmvacFm5kkBO1yMLsqHYvrG9rkIYO33j4/0pWW4gjhgRSvpHR7n0=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [MyList = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"MyList", type text}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "CSV", each Csv.Document([MyList],null,",")),
#"Expanded CSV" = Table.ExpandTableColumn(#"Added Custom", "CSV", {"Column1", "Column2", "Column3", "Column4", "Column5", "Column6", "Column7", "Column8", "Column9", "Column10", "Column11", "Column12", "Column13", "Column14", "Column15", "Column16", "Column17", "Column18", "Column19", "Column20"}, {"CSV.Column1", "CSV.Column2", "CSV.Column3", "CSV.Column4", "CSV.Column5", "CSV.Column6", "CSV.Column7", "CSV.Column8", "CSV.Column9", "CSV.Column10", "CSV.Column11", "CSV.Column12", "CSV.Column13", "CSV.Column14", "CSV.Column15", "CSV.Column16", "CSV.Column17", "CSV.Column18", "CSV.Column19", "CSV.Column20"}),
#"Unpivoted Columns" = Table.UnpivotOtherColumns(#"Expanded CSV", {"MyList"}, "Attribute", "Value"),
#"Removed Columns" = Table.RemoveColumns(#"Unpivoted Columns",{"MyList", "Attribute"}),
Value = #"Removed Columns"[Value]
in
ValuedslForPBI
8 years agoHelper I
Nice..unfortunately no, it doesn't work..that List.Contains is doing something really weird which I suspect has something to do with encoding. You end up with an empty list as a result..thanks though for all your efforts!!
- ImkeF8 years agoCommunity Champion
This sounds as if your parameter isn't actually a list, but a text-string (otherwise the function Text.ToList wouldn't work)
You said your parameter is: P1 = 543,95,96
To make this a list, you would have to wrap it into curly brackets like this: P1 = {543, 95, 96}