Forum Discussion

Valnus's avatar
Valnus
Helper II
4 years ago
Solved

Data cleanup and Grouping

Hi All    I have a very dirty data set ( text and numbers ). Below is the complaint field that is used as freetext in the system. As a result there is Numeric and Text values in the column  Ther...
  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi Valnus ,

     

    Yes, you need to run through the data set and defind the columns for all different strings you want to extract and group in you code.

    Just like this code. I create a calculated column to run through the dataset and defind the [complaint] column for all different strings I want and put them into groups like Cough/Check Up / Stomach and so on.

    Group = 
    SWITCH (
        TRUE (),
        CONTAINSSTRING ( 'Table'[complaint], "Cough" ), "Cough",
        CONTAINSSTRING ( 'Table'[complaint], "Check Up" ), "Check Up",
        CONTAINSSTRING ( 'Table'[complaint], "Stomach" ), "Stomach",
        CONTAINSSTRING ( 'Table'[complaint], "Backache" ), "Backache",
        "None"
    )

     

    Best Regards,
    Rico Zhou

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.