Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to trim duplicated values in a string KQL?

I have the following data sample:

let data = datatable(Name:string, Value:string)
            [
                "Device_1", "60.12.12 %",
                "Device_2", "40.12.12 %",
                "Device_3", "50.12.12 %",
                "Device_4", "48.33.33 %"
            ];

As you can see in the Value column, the values after the decimal points are duplicated.

How can we trim the second decimal point and the values after it ?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Expected result:

enter image description here

>Solution :

let data = datatable(Name:string, Value:string)
            [
                "Device_1", "60.12.12 %",
                "Device_2", "40.12.12 %",
                "Device_3", "50.12.12 %",
                "Device_4", "48.33.33 %"
            ];
data
| parse kind=regex Value with Percent:real
Name Value Percent
Device_1 60.12.12 % 60.12
Device_2 40.12.12 % 40.12
Device_3 50.12.12 % 50.12
Device_4 48.33.33 % 48.33

Fiddle

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading