Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

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 so...
  • v-yalanwu-msft's avatar
    4 years ago

    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.