Forum Discussion
Anonymous
4 years agoNot applicable
if Statement with conditions from list
Dear community members, Need support in Power Query data transformation. I have a column of Product Type column Product Type Books Furniture Technology Office Supplies ...
- 4 years ago
See the working here - Open a blank query - Home - Advanced Editor - Remove everything from there and paste the below code to test
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WcsrPzy5WitWJVnIrLcrLLCktSgXzQlKTM/Lyc/LTK8Fc/7S0zORUheDSgoKczFSIBoRWbCxsOggZGgsA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Product Type" = _t]), lstPrimeProduct = {"Furniture", "Office Supplies"}, #"Added Custom" = Table.AddColumn(Source, "Prime Product", each if List.Contains(lstPrimeProduct,[Product Type]) then "Y" else null) in #"Added Custom"
Vijay_A_Verma
Most Valuable Professional
4 years agoSee the working here - Open a blank query - Home - Advanced Editor - Remove everything from there and paste the below code to test
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WcsrPzy5WitWJVnIrLcrLLCktSgXzQlKTM/Lyc/LTK8Fc/7S0zORUheDSgoKczFSIBoRWbCxsOggZGgsA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Product Type" = _t]),
lstPrimeProduct = {"Furniture", "Office Supplies"},
#"Added Custom" = Table.AddColumn(Source, "Prime Product", each if List.Contains(lstPrimeProduct,[Product Type]) then "Y" else null)
in
#"Added Custom"