In power Q: creating a custom col based on condition: If col A contains text of col b then split col A starting at the position of the length of ColumB
example: col A is MyMothersBasement123 and col B is MyMothersBase col c would = ment123
Somthing along the lines of :
if Text.Contains([ColumnA], [ColumnB]) then SplitTextByPositions({length of ColumB}) else [ColumnA]
CodePudding user response:
Try
add column .. custom column ...
= try Text.Split([Column1],[Column2]){1} otherwise [Column1]
or
= try Text.Replace([Column1],[Column2],"") otherwise [Column1]
CodePudding user response:
You could also try
Text.AfterDelimiter([Column1], [Column2])
as long as [Column2] isn't blank.
You can use try ... otherwise
to cover that situation.
try Text.AfterDelimiter([Column1], [Column2]) otherwise ""