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
- 10.5K All Categories
- 8 Connect
- 918 Connectors
- 250 Workbench
- 473 Transform
- 1.7K Magic ETL
- 69 SQL DataFlows
- 478 Datasets
- 211 Visualize
- 257 Beast Mode
- 2.1K Charting
- 12 Variables
- 18 Automate
- 355 APIs & Domo Developer
- 89 Apps
- 3 Workflows
- 20 Predict
- 5 Jupyter Workspaces
- 15 R & Python Tiles
- 247 Distribute
- 63 Domo Everywhere
- 243 Scheduled Reports
- 21 Manage
- 42 Governance & Security
- 183 Product Ideas
- 1.2K Ideas Exchange
- 11 Community Forums
- 27 Getting Started
- 14 Community Member Introductions
- 55 Community News
- 4.5K Archive