Challenge #192: Crane Leasing
Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
ZenonH
8 - Asteroid
12-03-2019
12:02 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
First time using generate rows to fill Date data. Useful challenge.
(I also just now learned you can paste screenshots directly into the text editor, so no more saving pictures of my workflows for me!)
jmt214
8 - Asteroid
12-03-2019
12:04 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
kapratt
5 - Atom
12-03-2019
12:38 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Apparently reading the instructions is useful! At least I found two completely different methods of doing this!
benbenjoy
8 - Asteroid
12-03-2019
01:24 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
abrouwer
8 - Asteroid
12-03-2019
01:25 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
nivi_s
8 - Asteroid
12-03-2019
01:34 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
RichoBsJ
11 - Bolide
12-03-2019
02:05 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
SueDonim
8 - Asteroid
12-03-2019
09:53 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
I'm guessing there are more efficIient ways to do this, but it works
Now that I have reviewed other, more elegant, solutions, I am embarrassed at the complexity of my response. I was somewhat on the right track, but missed a couple of processes that would have made this much simpler....
Spoiler
It doesn't feel right that I had to duplicate the process for the two different cranes. Otherwise this doesn't seem too bad.
Process:
- Convert StartDate and End Date to date format
- Split into two duplicate threads, one for Tiny Tim and one for Maximus
- Filter data for status = "Leased" as if it is not leased we don't care why
- Generate rows for the 3 years of interest
- Join with data on Date and EndDate
- Union Left Join and Join to ensure all dates are captured
- Join with data on Date and StartDate
- Union Left Join and Join to ensure all dates are captured
- Initialise 1 Jan 2016 status for Tiny Tim as Leased and for Maximus as Not Leased
- Set Crane Name as either Tiny Tim or Maximus for all dates for the respective threads
- Multi-Row set Status as Leased or Not Leased depending on the presence or non-presence of Start Date (on current row) or End Date (on prior row), else = status of prior row
- Create a "Both" field where both cranes are leased (1) or not both leased (0)
- Sum of Both field
Process:
- Convert StartDate and End Date to date format
- Split into two duplicate threads, one for Tiny Tim and one for Maximus
- Filter data for status = "Leased" as if it is not leased we don't care why
- Generate rows for the 3 years of interest
- Join with data on Date and EndDate
- Union Left Join and Join to ensure all dates are captured
- Join with data on Date and StartDate
- Union Left Join and Join to ensure all dates are captured
- Initialise 1 Jan 2016 status for Tiny Tim as Leased and for Maximus as Not Leased
- Set Crane Name as either Tiny Tim or Maximus for all dates for the respective threads
- Multi-Row set Status as Leased or Not Leased depending on the presence or non-presence of Start Date (on current row) or End Date (on prior row), else = status of prior row
- Create a "Both" field where both cranes are leased (1) or not both leased (0)
- Sum of Both field
martybutchman
5 - Atom
12-04-2019
01:29 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
nataliamiteva
8 - Asteroid
12-04-2019
04:41 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator