Create a new column based on two event dates
- 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
I have two different tables
Table 1:
Event | Start | End |
A | XX0 | XX3 |
B | XX4 | XX5 |
A | XX5 | XX6 |
table 2:
Start/End | Date |
XX0 | 1-Jan |
XX1 | 5-Jan |
XX2 | 20-Feb |
XX3 | 3-Mar |
XX4 | 4-Jun |
XX5 | 4-Jul |
I need to create a new column in table 2 i.e Event. Event A starts at XX0 & ends before XX3. So, it should look at the "date" (Table2) and assign the Event as "A" for the respective "Start/End"(Table2).
My output should look like this.
Start/End | Date | Event |
XX0 | 1-Jan | A |
XX1 | 5-Jan | A |
XX2 | 20-Feb | A |
XX3 | 3-Mar | A |
XX4 | 4-Jun | B |
XX5 | 4-Jul | A |
Please help.
Solved! Go to Solution.
- Labels:
- Tips and Tricks
- Transformation
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Thankyou. table2 'Start/End' are not exactly in the same range. For Example, ABC,DER,FER, etc. The dates attached to these codes are different. How do i go about this?
Start/End | Date |
ABC | 1-Jan |
CDE | 5-Jan |
FER | 20-Feb |
REF | 3-Mar |
TEG | 4-Jun |
VER | 4-Jul |
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Can you explain the logic you would use here for matching these?
How would you know that CDE is between ABC and XX3?
Maybe we need some data that more closely matches your real data, or I am misunderstanding your request.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Sorry for the confusion. I have changed the inputs to closely match my data.
Inputs
Event | Start | End |
A | ABC | JUH |
B | ABC | CDE |
Start/End | Date |
ABC | 1-Jan |
ABC | 1-Jan |
CDE | 5-Jan |
EFG | 20-Feb |
HIJ | 3-Mar |
JUH | 4-Jun |
Logic: Event A should begin at the date of "ABC" and end before the date of "JUH"
Output:
Venue | Start/End | Event |
ABC | 1-Jan | A |
ABC | 1-Jan | B |
CDE | 5-Jan | A |
EFG | 20-Feb | A |
HIJ | 3-Mar | A |
JUH | 4-Jun |
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Thankyou!
