Hello Alteryx community,
I am looking for help in extracting an abbreviated date from a string. Then, I'll use that date to count the number of days between it and another datetime column. Here is an example dataset:
ID | DateTime | Event Tag |
1 | 2019-03-18 | Bakersfield (Apr 22) |
2 | 2019-03-18 | Thomaston (Jun 26) |
3 | 2019-03-18 | Callifer (Sep 2) |
As you can see, the dates in DateTime can be the same but have event tags for days near and far. For reference, the values in Event Tag are always structured the same way: "LOCATION (MMM DD)." What I need to do is clean the cell so all that's left is "Apr 22" or "Jun 26" or "Sep 2," which I can then parse into a date. Here's what I need to see in the next step:
ID | DateTime | Event Tag | Event Tag Date |
1 | 2019-03-18 | Bakersfield (Apr 22) | 2019-04-22 |
2 | 2019-03-18 | Thomaston (Jun 26) | 2019-06-26 |
3 | 2019-03-18 | Callifer (Sep 2) | 2019-09-02 |
Finally, I want to count the number of days between DateTime and Event Tag Date, so the final dataset appears as follows:
ID | DateTime | Event Tag | Event Tag Date | DaysInBetween |
1 | 2019-03-18 | Bakersfield (Apr 22) | 2019-04-22 | 32 |
2 | 2019-03-18 | Thomaston (Jun 26) | 2019-06-26 | 68 |
3 | 2019-03-18 | Callifer (Sep 2) | 2019-09-02 | 140 |
The final dataset will help me assess the time between the date of a purchase and the event to which the purchase applies.
Solved! Go to Solution.
Hi @essemMLB ,
Attached is an example showing how you can accomplish that.
Let me know if that works for you, please.
Best,
Fernando V.
Thank you so much!