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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply

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
v-tangjie-msft
Community Support
Community Support

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
v-tangjie-msft
Community Support
Community Support

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 @v-tangjie-msft  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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.

Top Kudoed Authors