Forum Discussion

EricC's avatar
EricC
Frequent Visitor
8 years ago
Solved

Splitting Column Assistance

Hey Guys,   So I am running into a hiccup, I know how to do this in excel but am struggling how to do it in powerBI.   So I have a column in this format: USERNAME17 or USERNAME7, so I can't set t...
  • Anonymous's avatar
    Anonymous
    8 years ago

    What about this?

    Table.AddColumn(<Previous Step>, "Position to Split", each List.PositionOfAny([UsernameColumn], {"0","1","2","3","4","5","6","7","8","9"}, Occurrence.First), Int64.Type),

    This should return the 0-based offset of where the first # shows up in the name.  Basically, it's looking in the UserNameColumn for any instance of those 10 numbers (formatted as text).

     

    Then you can add the 2 columns using this [Position to Split] and Text.Start() and Text.End() to grab the right number of characters.  You'll probably need Text.Length() as well.