Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Premlatapandey9
Microsoft Employee
Microsoft Employee

How to add a category column based on existing Title column

Hello Everyone,

I would like to add a category column based on an existing text column in my table. I have the text column as shown below, and I have provided the desired result that I aim to achieve:

Text Column: 

Title
Books and notebooks logistic order#12646484 is in Exception State and its ETA is 10 Days
Mismatch in Production and load delivery
ordered item is not matching with origiinal order
I have found few mismatch in the ordered plant and received plant

 

Desired Result: 

TitleCategory 
Books and notebooks logistic order#12646484 is in Exception State and its ETA is 10 DaysBooks and Notebooks Order Issue
Mismatch in Production and load deliveryMismatch in production & Load
ordered item is not matching with origiinal orderOrder Mismatch
I have found few mismatch in the ordered plant and received plantPlant micmatch Issue

 

Please help me with the Dax query to achive this result if possible any hlep in this regard is much appreciated

Thanks and Regards

@member @Anonymous 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Premlatapandey9 ,

 

You can create a calculated column.

Category = 
SWITCH (
    TRUE (),
    CONTAINSSTRING ( TableName[Title], "Books and notebooks" ), "Books and Notebooks Order Issue",
    CONTAINSSTRING ( TableName[Title], "Mismatch in Production" ), "Mismatch in production & Load",
    CONTAINSSTRING ( TableName[Title], "ordered item" ), "Order Mismatch",
    CONTAINSSTRING ( TableName[Title], "mismatch in the ordered plant" ), "Plant mismatch Issue",
    "Other"
)

vtangjiemsft_0-1692150209035.png

Best Regards,

Neeko Tang

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

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @Premlatapandey9 ,

 

You can create a calculated column.

Category = 
SWITCH (
    TRUE (),
    CONTAINSSTRING ( TableName[Title], "Books and notebooks" ), "Books and Notebooks Order Issue",
    CONTAINSSTRING ( TableName[Title], "Mismatch in Production" ), "Mismatch in production & Load",
    CONTAINSSTRING ( TableName[Title], "ordered item" ), "Order Mismatch",
    CONTAINSSTRING ( TableName[Title], "mismatch in the ordered plant" ), "Plant mismatch Issue",
    "Other"
)

vtangjiemsft_0-1692150209035.png

Best Regards,

Neeko Tang

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

Hello @Anonymous  This is amazing I am incredibly grateful for your time and expertise. Your willingness to help is awesom, and I wanted to express my sincere appreciation. Kudos to you for your outstanding efforts!

lbendlin
Super User
Super User

What if your text matches multiple categories?  Do you have a preferred matching order?

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.