How to change a string to date ?
Comments
-
If you're missing a day, you'll have to add one before using the STR_TO_DATE function.
You could try this:
STR_TO_DATE(CONCAT('01-',`DateColumn`), '%d-%b-%y')
That should convert all month/year strings to a usable date.
Let me know if you have any other questions,
ValiantSpur
**Please mark "Accept as Solution" if this post solves your problem
**Say "Thanks" by clicking the "heart" in the post that helped you.0 -
Thanks for the quick reply
The solution you suggested worked !
The dataset I have is aggregated at monthly level and I need to use this field in the quick filter with Months starting from Nov, 2017 till March, 2018
The quick filter should have values such as Nov, 17, Dec,17, till Mar,18
Kindly suggest if it is possible
1 -
If you're using whole month aggregates, the only method would either be to default the months to always use the first day of the month as in my original suggestion (this would allow you to use a date quick filter).
The other option if you don't want days is to leave it as a string with Month/Year and the user would have to select each individual month.
There's not a way to have it select "between" two aggregated dates.
0 -
You could set up a beastmode to filter the dates that you want. Although you would not be able to alter the dates via the quickfilter any more.
case when `Date Column` IN('Nov-17','Dec-17','Jan-18','Feb-18','Mar-18') then 'True' else 'False' end
Or, if you change your string column to a date first:
case when `Date field` >='01-Nov-17' and `Date field` <='01-Mar-18' then 'True' else 'False' end
You could then use that beastmode as a filter. If you select only the 'True' rows, then your data will be filtered for dates betwee Nov-17 and Mar-18
0 -
If I use the second option of keeping the date column as is (String), in the quick filter it is sorted based on the Alphabets
The result that comes out is in this order
Dec-17, Feb-18, Jan-18...
The dates should be arranged chronologically
0 -
Correct, if you leave it as a string, then the quick filter is sorted alphabetically. If you change it to a date, you need to include the day as well.
Do these months refer to a specific time frame for your fiscal year? You could use a beastmode to label it something like '2017 Q4', etc. Just be thoughtful about what you decide to call it so that when it is sorted (alphabetically) it displays in the correct order.
It may be easier if you could provide a screenshot of what you are working with and how you would like it to be displayed
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