cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

splitting delimiter in column and make exception

Hi guys,

Hope you can help me with this issue.

 

I'm Splitting a column by delimiter and it looks like this:

    #"Split Column by Delimiter" = Table.SplitColumn(#"Duplicated Column1", "xxx", Splitter.SplitTextByDelimiter("-", QuoteStyle.Csv), {"xxx1", "xxx2"}),

As you can see, I use "-" to split the text.

But I need to make an exception on it. 

If it recognizes "- SpecificWord" so don't split it.

 

Any idea how I can make it work?

Thank you!

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi,

Try using the below DAX to create the calculated column.

Here Data[Name] is the field which is to be split.

 
column_name =
VAR split_string = PATHITEM(SUBSTITUTE(Data[Name], "-", "|"), 2)
RETURN
IF( split_string == "specific string", Data[Name], split_string )
 
Thanks.

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi,

Try using the below DAX to create the calculated column.

Here Data[Name] is the field which is to be split.

 
column_name =
VAR split_string = PATHITEM(SUBSTITUTE(Data[Name], "-", "|"), 2)
RETURN
IF( split_string == "specific string", Data[Name], split_string )
 
Thanks.

Helpful resources

Announcements
Carousel_PBI_Wave1

2023 Release Wave 1 Plans

Power BI release plans for 2023 release wave 1 describes all new features releasing from April 2023 through September 2023.

Power BI Summit Carousel 2

Global Power BI Training

Make sure you register today for the Power BI Summit 2023. Don't miss all of the great sessions and speakers!

Thank you 2022 Review

2022 Monthly Feature Releases

We had a great 2022 with a ton of feature releases to help you drive a data culture.