Forum Discussion
Extracting specific dates from text column
- Anonymous6 years ago
if Text.Contains([Sources], "ZP")
then
Text.Middle([Sources],Text.PositionOf([Sources], "ZP") -13,11)
else
null
Text.Middle goes into sources, starting from the position of "ZP" minus 13 and extracts 11 charachters.
Adjust 13 and 11 if needed.
I would add a custom formula in powerquery using a if
ZP Date=
if (string contains ZP) then
find the position of "ZP", go back 13 chars and get 10 chars, trim it -> return this value
else
return emtpy
PreAssessment Date=
if (string contains Pre-Assessment) then
find the position of "ZP", go back 13 chars and get 10 chars, trim it -> return this value
else
return emtpy
etc
TextBetweenDelimiters works fine when your data is very well structured.
Anonymous , thank you. I think your solution will work, but I'm having trouble with the "get 10 chars, trim it -> return this value.." portion. What do I need to add from here?
ZPDate:
if Text.Contains([Sources], "ZP") then Text.PositionOf([Sources], "ZP", -13) else null
Thanks,
Brian
- Anonymous6 years agoNot applicable
if Text.Contains([Sources], "ZP")
then
Text.Middle([Sources],Text.PositionOf([Sources], "ZP") -13,11)
else
null
Text.Middle goes into sources, starting from the position of "ZP" minus 13 and extracts 11 charachters.
Adjust 13 and 11 if needed.