Date on a CSV as text to convert to a useable fate format
Hello
I have been given some data to process daily, it has a date column but its formatted as Text, and has a short month, for example it looks like:
01 Jan
Data in DOMO looks like:
There is another column that has the full month name and the year (as a month summary) so i have trued to split out the Short and Date Summary to make something like 01 January 2024 and convert it to a date format but the ETL is throwing up an error saying it cannot convert it.
Is there another way?
Thanks
Rob
Best Answer
-
In MagicETL use the formula tile and create the following formula:
DATE(CONCAT(
-- Year
REGEXP_REPLACE(SummaryDate1, '[^0-9]+',''),'-',-- Month
CASE WHEN REGEXP_REPLACE(SummaryDate1, '[0-9]','') LIKE 'Jan%' THEN '01'
WHEN REGEXP_REPLACE(SummaryDate1, '[0-9]','') LIKE 'Feb%' THEN '02'
WHEN REGEXP_REPLACE(SummaryDate1, '[0-9]','') LIKE 'Mar%' THEN '03'
WHEN REGEXP_REPLACE(SummaryDate1, '[0-9]','') LIKE 'Apr%' THEN '04'
WHEN REGEXP_REPLACE(SummaryDate1, '[0-9]','') LIKE 'May%' THEN '05'
WHEN REGEXP_REPLACE(SummaryDate1, '[0-9]','') LIKE 'Jun%' THEN '06'
WHEN REGEXP_REPLACE(SummaryDate1, '[0-9]','') LIKE 'Jul%' THEN '07'
WHEN REGEXP_REPLACE(SummaryDate1, '[0-9]','') LIKE 'Aug%' THEN '08'
WHEN REGEXP_REPLACE(SummaryDate1, '[0-9]','') LIKE 'Sep%' THEN '09'
WHEN REGEXP_REPLACE(SummaryDate1, '[0-9]','') LIKE 'Oct%' THEN '10'
WHEN REGEXP_REPLACE(SummaryDate1, '[0-9]','') LIKE 'Nov%' THEN '11'
WHEN REGEXP_REPLACE(SummaryDate1, '[0-9]','') LIKE 'Dec%' THEN '12'
END,'-',
-- Day
LEFT(InspectionClosed,2)))
The result:If I solved your problem, please select "yes" above
1
Answers
-
If the text is consistent….such as Jan always being "Jan"…you could split the values into multiple columns. One for the day and one for the short month name. Then convert the short month into its corresponding full month name, or use some logic in a formula to get the months back into a numeric. Then combine the day, full month name, and year to create a new column such as 01 February 2024. Then do a date convert into an actual date data type.
But it looks like that's what you are already trying. What's the error say?** Was this post helpful? Click Agree or Like below. **
** Did this solve your problem? Accept it as a solution! **0 -
In MagicETL use the formula tile and create the following formula:
DATE(CONCAT(
-- Year
REGEXP_REPLACE(SummaryDate1, '[^0-9]+',''),'-',-- Month
CASE WHEN REGEXP_REPLACE(SummaryDate1, '[0-9]','') LIKE 'Jan%' THEN '01'
WHEN REGEXP_REPLACE(SummaryDate1, '[0-9]','') LIKE 'Feb%' THEN '02'
WHEN REGEXP_REPLACE(SummaryDate1, '[0-9]','') LIKE 'Mar%' THEN '03'
WHEN REGEXP_REPLACE(SummaryDate1, '[0-9]','') LIKE 'Apr%' THEN '04'
WHEN REGEXP_REPLACE(SummaryDate1, '[0-9]','') LIKE 'May%' THEN '05'
WHEN REGEXP_REPLACE(SummaryDate1, '[0-9]','') LIKE 'Jun%' THEN '06'
WHEN REGEXP_REPLACE(SummaryDate1, '[0-9]','') LIKE 'Jul%' THEN '07'
WHEN REGEXP_REPLACE(SummaryDate1, '[0-9]','') LIKE 'Aug%' THEN '08'
WHEN REGEXP_REPLACE(SummaryDate1, '[0-9]','') LIKE 'Sep%' THEN '09'
WHEN REGEXP_REPLACE(SummaryDate1, '[0-9]','') LIKE 'Oct%' THEN '10'
WHEN REGEXP_REPLACE(SummaryDate1, '[0-9]','') LIKE 'Nov%' THEN '11'
WHEN REGEXP_REPLACE(SummaryDate1, '[0-9]','') LIKE 'Dec%' THEN '12'
END,'-',
-- Day
LEFT(InspectionClosed,2)))
The result:If I solved your problem, please select "yes" above
1 -
This worked a treat, thanks for your answer.
0
Categories
- All Categories
- 1.8K Product Ideas
- 1.8K Ideas Exchange
- 1.6K Connect
- 1.2K Connectors
- 300 Workbench
- 6 Cloud Amplifier
- 9 Federated
- 2.9K Transform
- 102 SQL DataFlows
- 626 Datasets
- 2.2K Magic ETL
- 3.9K Visualize
- 2.5K Charting
- 753 Beast Mode
- 61 App Studio
- 41 Variables
- 692 Automate
- 177 Apps
- 456 APIs & Domo Developer
- 49 Workflows
- 10 DomoAI
- 38 Predict
- 16 Jupyter Workspaces
- 22 R & Python Tiles
- 398 Distribute
- 115 Domo Everywhere
- 276 Scheduled Reports
- 7 Software Integrations
- 130 Manage
- 127 Governance & Security
- 8 Domo Community Gallery
- 38 Product Releases
- 11 Domo University
- 5.4K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 110 Community Announcements
- 4.8K Archive