Create Quarter Field based on Date Field
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hello,
I have a date field, and I would like to create a new column that aligns with the date to reflect the quarter it's in.
So with the date provided above, the new field would have Q3.
I thought I could do this with the DATETIME tool, however, I cannot.
Please and Thank you!!! as always :)
Adam
Solved! Go to Solution.
- Labels:
- Datasets
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hey @Adam_B, just one of those we have to calculate ourselves (at least for now!):
I did actually create this as a possible output in a macro I created a while ago, though it only prints out the number: https://community.alteryx.com/t5/Community-Gallery/Enhanced-DateTimeTrim/ta-p/972535
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@DataNath So I have to enter in the Quarter manually? Can I establish a range?
For Example,
If date IN 1/1/2020-3/31/2020 then Q1 or 4/1/2020-6/30/2020 then Q2?
Just not sure how to format that formula.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Oh no @Adam_B, when I said calculate ourselves I just meant we need to set up a formula. What I've posted above will still dynamically calculate any date's quarter. All the calc is doing is taking the month part of the date as an integer i.e. 5 for May right now, dividing it by 3 and then rounding that up to the next whole number which gives you the quarter. The final ToString() function around the outside just allows you to have the number as text so you can add the 'Q' to it for formatting.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@DataNath Thank you!!!
![](/skins/images/33644471E927638F516C93A75ADDEE18/responsive_peak/images/icon_anonymous_message.png)