Transforming 6 digit integer to a date when bad values are involved
I have a dataset with chunks of bad data in it. To get a MFG date I pulled the first 6 digits of the serial # to get a "date" in an text format.
if the data is correct it should read out the correct date, but in some cases the data will have 06B378 or other letters or texts that should not be in there. How would I go about excluding the bad data as well as converting the good 6 digit data into a date format?
Let me know your thoughts or how I go about this. I tried to alter columns to integers and inherit bad values as null but it seems to not be catching all bad values.
Thanks
Answers
-
Hi @gbrown ,
So you're going to go have to do 2 steps:
1) Determine which cells are truly numeric
2) Convert the numeric ones to dates
Here are the formulas to do the steps:
1) CASE
WHEN STR_REMOVE_DIGITS(`Date_Temp`)='' THEN 1 END
2) CASE
WHEN `Numeric Format Flag`=1
THEN CAST(CONCAT('20',RIGHT(`Date_Temp`,2),'-',left(`Date_Temp`,2),'-',SUBSTRING(`Date_Temp`,3,2)) as date)
END
Even better! Here's a video of me explaing what all this mumbo jumbo is: https://www.loom.com/share/ebf8d97b0ec94d458b6d09813dc93e2c
Hope that helps,
John Le
More video solutions at https://www.dashboarddudes.com/pantry
John Le
You're only one dashboard away.
Click here for more video solutions:
1
Categories
- All Categories
- 1.7K Product Ideas
- 1.7K Ideas Exchange
- 1.5K Connect
- 1.2K Connectors
- 295 Workbench
- 6 Cloud Amplifier
- 8 Federated
- 2.8K Transform
- 97 SQL DataFlows
- 608 Datasets
- 2.1K Magic ETL
- 3.8K Visualize
- 2.4K Charting
- 709 Beast Mode
- 49 App Studio
- 39 Variables
- 667 Automate
- 170 Apps
- 446 APIs & Domo Developer
- 44 Workflows
- 7 DomoAI
- 33 Predict
- 13 Jupyter Workspaces
- 20 R & Python Tiles
- 391 Distribute
- 111 Domo Everywhere
- 274 Scheduled Reports
- 6 Software Integrations
- 115 Manage
- 112 Governance & Security
- Domo Community Gallery
- 31 Product Releases
- 9 Domo University
- 5.3K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 103 Community Announcements
- 4.8K Archive