Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
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 |
| Books |
| Books |
| Books |
| Office Supplies |
| Technology |
| Office Supplies |
The objective is to add one conditional column which takes input from a list to return required value
List:
lstPrimeProduct
| Furniture |
| Office Supplies |
Output:
| Product Type | Prime Product |
| Books | |
| Furniture | Y |
| Technology | |
| Office Supplies | Y |
| Books | |
| Books | |
| Books | |
| Office Supplies | Y |
| Technology | |
| Office Supplies | Y |
Please advise.
Thanks
vir
Solved! Go to Solution.
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"
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"
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 8 | |
| 7 | |
| 5 | |
| 4 | |
| 3 |