Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Sorting columns of text

Hi there,

 

New to the forum and also power bi.

 

I am currently trying trouble sorting a column of different text descriptions. The column currently contains phrases such as xxxx completed, completed, delivered xxxx, cancelled,,, xxx cancelled,,, and another 100 or so phrases. That isnt the issue. 

 

What I am wanting to do is generate another column where by if the word cancelled is contained within column 1, in column 2 it just shows cancelled. 

If column 1 contains completed or delivered column 2 then calls it completed.

if column 1 does not contain any of these words then column 2 calls it in progress. 

 

Im trying to crete this column 2 for use in a slicer. So if there is another way of achieving the same outcome, ie. grouping a column of 100 different texts into 3 I am open to suggestions.

 

Thanks in advance people.

  • Anonymous's avatar
    Anonymous
    5 years ago

    Hi Anonymous 

    You can use conditional column function in Power Query Editor.

    Due to I don't know your data model, I build a sample to have a test.

    Conditioal column function and result,

    You can download the pbix file from this link: Sorting columns of text

     

    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.

3 Replies

  • AlB's avatar
    AlB
    Icon for Community Champion rankCommunity Champion

    Hi Anonymous 

    This can be best done in Power Query. Please paste some sample data in text-tabular format so that it can be copied

    Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

    Contact me privately for support with any larger-scale BI needs, tutoring, etc.

    Cheers 

     

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous 

    You can use conditional column function in Power Query Editor.

    Due to I don't know your data model, I build a sample to have a test.

    Conditioal column function and result,

    You can download the pbix file from this link: Sorting columns of text

     

    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.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous 

    Could you tell me if your problem has been solved? If it is, kindly Accept it as the solution. More people will benefit from it. Or you are still confused about it, please provide me with more details about your table and your problem or share me with your pbix file from your Onedrive for Business.

     

    Best Regards,

    Rico Zhou