Forum Discussion
How to create subcategory
Hello,
| model | operatingSystem |
| HoloLens | Windows |
| UC-Engine | Windows |
| UC-Engine | Windows |
so if the model equals UC-Engine I would like to change the value of operatingSystem to something new.
How do I do this? I dont want to create a new column or table for that, just replace the values and leave all the other values where model is not UC-Engine.
Thank you very much!
Hi, Anonymous ;
You could add a condtion column in power query then delete original column.
1.add new column.
= Table.AddColumn(#"Changed Type", "operatingSystem2", each if [model] = "UC-Engine" then "new" else [operatingSystem])2.delete original column,
The final output is shown below:
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W8sjPyfdJzStW0lEKz8xLyS8vVorViVYKddZ1zUvPzEslRjwWAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [model = _t, operatingSystem = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"model", type text}, {"operatingSystem", type text}}), #"Added Conditional Column" = Table.AddColumn(#"Changed Type", "operatingSystem2", each if [model] = "UC-Engine" then "new" else [operatingSystem]), #"Removed Columns" = Table.RemoveColumns(#"Added Conditional Column",{"operatingSystem"}), #"Renamed Columns" = Table.RenameColumns(#"Removed Columns",{{"operatingSystem2", "operatingSystem"}}) in #"Renamed Columns"
Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
3 Replies
- mh2587Super User
You can do this in PQ
- AnonymousNot applicable
What do I have to do?
- v-yalanwu-msftCommunity Support
Hi, Anonymous ;
You could add a condtion column in power query then delete original column.
1.add new column.
= Table.AddColumn(#"Changed Type", "operatingSystem2", each if [model] = "UC-Engine" then "new" else [operatingSystem])2.delete original column,
The final output is shown below:
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W8sjPyfdJzStW0lEKz8xLyS8vVorViVYKddZ1zUvPzEslRjwWAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [model = _t, operatingSystem = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"model", type text}, {"operatingSystem", type text}}), #"Added Conditional Column" = Table.AddColumn(#"Changed Type", "operatingSystem2", each if [model] = "UC-Engine" then "new" else [operatingSystem]), #"Removed Columns" = Table.RemoveColumns(#"Added Conditional Column",{"operatingSystem"}), #"Renamed Columns" = Table.RenameColumns(#"Removed Columns",{{"operatingSystem2", "operatingSystem"}}) in #"Renamed Columns"
Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.