Forum Discussion

ugoriuko's avatar
ugoriuko
Frequent Visitor
3 years ago
Solved

Extract decimal number from string/array in a column

 Hello Everyone,   I need help extracting the decimal value(probability) in the colmn below to a new column Where column is "None", just return "None" I appreciate your usual assistance.   Than...
  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi ugoriuko

    let
        Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("jVRbSxthFPwrHz5v23O/PIdiX2KhkAqKD0EDBWOURCil9L/3bLJKLttqQshDMmfmzMzZ6+uz35PlfLNp3DX4mISulJQWrl379v3q6vJ89gHNkowywEzq8+fspivg54en5189TFwdUjyUE9XsBKkeEUiRA3KPkoUACGoAipGfghEdg8zDB/Bsdb96/Llqn9psdbtczNftaTm/na/vNv08DAn0TOSUJNeTNUCYAd0d3jUvg0o8hCafWKLpUj9TCTxYLHvgyZ8NIdIMBd9FzFx29qZxmpev0rUvk4vJ9HI6zFNTIK595DgPcxMHjSCuNIWOlTCRopS1L5YeDkZTRRcA6Nr/NSpEESVnmAsJDeMO2bC4oOLX2mDnT2yNxd64Sp7VS0yOSZEUJgnIt6VUfzyIyLTqNqZDEtM0qqT61izMyCp7iLBCGuqoNvNklboY7Nqr9WyERtUJrN/QRg0WY0l1x9xH1ry6OwBL2b4G0ovH1WJshhIXl2rY3ozMrEpINXXUAZG634oqX5MYrr6WrfzCqb5hNMWyAutsWIP3+djZfXheHOs9wmO1oG69x++3IAvpCL1l9eZR7krBNKsH/oLNHbaOWMHrSMb3ZcJwqBzh0CPdPlP+YRIlRGVYJnbt6/OPxbpN5+v7bS8qFN5x3fwF", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [material_type1 = _t]),
        #"Changed Type" = Table.TransformColumnTypes(Source,{{"material_type1", type text}}),
        #"Split Column by Delimiter" = Table.ExpandListColumn(Table.TransformColumns(#"Changed Type", {{"material_type1", Splitter.SplitTextByDelimiter(",", QuoteStyle.Csv), let itemType = (type nullable text) meta [Serialized.Text = true] in type {itemType}}}), "material_type1"),
        #"Filtered Rows" = Table.SelectRows(#"Split Column by Delimiter", each Text.Contains([material_type1], ".") or [material_type1] = "None"),
        #"Replaced Value" = Table.ReplaceValue(#"Filtered Rows","}","",Replacer.ReplaceText,{"material_type1"})
    in
        #"Replaced Value"

    Best Regards,
    Gao

    Community Support Team

     

    If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

    How to get your questions answered quickly -- How to provide sample data