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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
JNelson
Helper II
Helper II

Split Column to first instance of number only

Hi there!

 

I have a messy column that I need to split off the first instance of digit (the number of digits differs by each row) and leave the rest of the cell contents as is.

I tried to Split Column Digit to Non Digit which is almost there, but it splits off at every instance of digit (ie. will extend to 4 or more custom columns).

 

Example:

JNelson_0-1707965519001.png

 

Any ideas?

 

Thanks 🙂

1 ACCEPTED SOLUTION
AlienSx
Super User
Super User

hi, @JNelson 

let
    Source = table_with_messy_column,
    chars = List.Buffer({"a".."z", "A".."Z", " "}),
    split = Table.SplitColumn(
        Source, "Logistics", 
        (x) => Splitter.SplitTextByPositions(
            {0, List.PositionOfAny(Text.ToList(x), chars, Occurrence.First)}
        )(x),
        {"Custom", "Custom.1"}
    )
in
    split

View solution in original post

4 REPLIES 4
AlienSx
Super User
Super User

hi, @JNelson 

let
    Source = table_with_messy_column,
    chars = List.Buffer({"a".."z", "A".."Z", " "}),
    split = Table.SplitColumn(
        Source, "Logistics", 
        (x) => Splitter.SplitTextByPositions(
            {0, List.PositionOfAny(Text.ToList(x), chars, Occurrence.First)}
        )(x),
        {"Custom", "Custom.1"}
    )
in
    split

Hi @AlienSx ,

May be a silly question, but how do I insert that into my existing Advanced Editor?

My last step is currently #"Removed Other Columns". I think I'm getting confused because this looks like an entire editor (with the let and in parts). 

Thanks!

Thank you! Got it.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors
Top Kudoed Authors