Forum Discussion
Multiple date formats in column
- 4 years ago
Leave everything, in a custom column put this. That's it.
= Date.From(if Text.Contains(Text.From([Live date]),"'") then "1"&Text.Replace([Live date],"'","") else [Live date])If you want to convert this column to a date, select column - Transform tab - Detect data type
Ok let me try..here is sample data from my Excel file
| 22-Jun-21 |
| 08-Nov-21 |
| 08-Nov-21 |
| 08-Nov-21 |
| 08-Nov-21 |
| 08-Nov-21 |
| March '22 |
| March '22 |
| March '22 |
| March '22 |
Here is the exact code I am using
Table.AddColumn(Source, "Date Effective", each Date.From(if Text.Contains([Live date],"'") then "1"&Text.Replace([Live date],"'","") else[Live date]), type date)
My column name in the Excel file is [Live date] .
Hope this helps
See the code below where I have changed Text.Contains([Live date],"'") to Text.Contains(Text.From([Live date]),"'")
let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
Result = Table.AddColumn(Source, "Date Effective", each Date.From(if Text.Contains(Text.From([Live date]),"'") then "1"&Text.Replace([Live date],"'","") else [Live date]))
in
Result
- lornafnb4 years agoHelper I
1. your first statement -
let Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],1. do I paste it into the Applied step Source?
2. The next part - I assume that is the new calculated column - please explain the change?
Thankful
- Vijay_A_Verma4 years agoMost Valuable Professional
Leave everything, in a custom column put this. That's it.
= Date.From(if Text.Contains(Text.From([Live date]),"'") then "1"&Text.Replace([Live date],"'","") else [Live date])If you want to convert this column to a date, select column - Transform tab - Detect data type
- lornafnb4 years agoHelper I
Stunning - it works. Please may you explain what made it work?
Appreciate your assistance.