cancel
Showing results for
Did you mean:

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Helper I

Extract field value in Power Query to a new column based on conditions

Hello everyone,

I wish to extract specific values in a column to a new column. The rule is that the values need to start with 75 or 76 and can have maximum of 10 digits. Examples below should make it clear.

 Input Result PO: 7500013234 - SO -12832 7500013234 SO117934 PO-7500012312 7500012312 PN; 15800-024A/7600012040 7600012040 PO7500012030 -SO-12312 7500012030

Kindly help. I would need this on Power Query.
Thank you.

1 ACCEPTED SOLUTION
Super User

Try this custom column in Power Query:

``````if Text.PositionOf([Input], "75") <> - 1 then
Text.Middle([Input], Text.PositionOf([Input], "75"), 10)
else if Text.PositionOf([Input], "76") <> - 1 then
Text.Middle([Input], Text.PositionOf([Input], "76"), 10)
else
null``````

Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

2 REPLIES 2
Helper I

@DataInsights Worked like a charm. Thank you! 🙂

Super User

Try this custom column in Power Query:

``````if Text.PositionOf([Input], "75") <> - 1 then
Text.Middle([Input], Text.PositionOf([Input], "75"), 10)
else if Text.PositionOf([Input], "76") <> - 1 then
Text.Middle([Input], Text.PositionOf([Input], "76"), 10)
else
null``````

Did I answer your question? Mark my post as a solution!

Proud to be a Super User!