Forum Discussion
Visualization
7 years agoRegular Visitor
Extracting specific values from a column
Hello, I'm currently trying to extract specific values from a column into a new column in power query. The column consists of differing values (dates, numbers, words) and I would only like the new co...
- 7 years ago
Did you ensure you were replacing the other step, and not creating a new one?
Otherwise, you could try adding a Custom Column in the add column tab, and use the code:
if
Text.Contains([Column1] ,"-") or Text.Contains([Column1] ,"/") or Text.Contains([Column1] ,"\")
then
try
Date.FromText([Column1])
otherwise
null
else
nullChange the red to your column.
It first looks for any of - / \ and if it finds them, tries to transform it to a date
Visualization
7 years agoRegular Visitor
Unfortunately this resulted in the same output, where the numbers changed to date/time/timezone rather than error.
SteveCampbell
7 years agoMemorable Member
Did you ensure you were replacing the other step, and not creating a new one?
Otherwise, you could try adding a Custom Column in the add column tab, and use the code:
if
Text.Contains([Column1] ,"-") or Text.Contains([Column1] ,"/") or Text.Contains([Column1] ,"\")
then
try
Date.FromText([Column1])
otherwise
null
else
null
Change the red to your column.
It first looks for any of - / \ and if it finds them, tries to transform it to a date