Convert all dates to last day of year
I am trying to convert all my dates to the last day of the year in a beast mode. I have a column in my dataset that is already showing the year for the data and have tried this
STR_TO_DATE( CONCAT(`YEAR`,'-',12,'-',31),' %Y-%m-%d ')
It doesn't seem to work. Any help would be appreciated
Comments
-
Not sure if it was a typo or not... but you have some commas in strange places. Try this:
STR_TO_DATE(CONCAT(`YEAR`,'-12-31'),'%Y-%m-%d')
“There is a superhero in all of us, we just need the courage to put on the cape.” -Superman3 -
@apatten You also had spaces extra spaces in your date format qualifiers, which would prevent it from recognizing the dates. @ST_-Superman-_ 's formula should fix that.
1 -
For another option:
STR_TO_DATE(`y` + 1, '%Y') - 1
'%Y'
- defaults to the first of the year+1
Add a year-1
Subtracts a dayy
here is the year in integer format.In other words, it's converting the given year to be the first day of the next year then subtracting 1 day to get the last day of the given year
**Was this post helpful? Click Agree or Like below**
**Did this solve your problem? Accept it as a solution!**1
Categories
- 10.5K All Categories
- 8 Connect
- 918 Connectors
- 250 Workbench
- 470 Transform
- 1.7K Magic ETL
- 69 SQL DataFlows
- 477 Datasets
- 193 Visualize
- 252 Beast Mode
- 2.1K Charting
- 11 Variables
- 17 Automate
- 354 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
- 174 Product Ideas
- 1.2K Ideas Exchange
- 12 Community Forums
- 27 Getting Started
- 14 Community Member Introductions
- 55 Community News
- 4.5K Archive