Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Weekly Challenges

Solve the challenge, share your solution and summit the ranks of our Community!

Also available in | Français | Português | Español | 日本語
IDEAS WANTED

Want to get involved? We're always looking for ideas and content for Weekly Challenges.

SUBMIT YOUR IDEA

Challenge #310: Maintenance Schedule

AYXAcademy
Alteryx
Alteryx

A solution to last week’s challenge can be found here.

 

Weekly Challenge Image 310.png

This week we have a data restructuring challenge regarding equipment maintenance schedules. Imagine that you’ve been tasked with creating an Excel spreadsheet which reports the days on which a truck was in the shop for service. Currently the data are structured such that there are multiple records per truck ID, a date-in value and a date-out value, and a “pattern” variable to indicate on which days the truck was actually being serviced.

 

A large shipping firm has a fleet of thousands of trucks (though the data for this challenge is provided for only two trucks). The company’s management needs the maintenance history for every truck, placing a 0 or a 1 in the column for every date - beginning at the earliest date in the data and continuing to the latest date – on which the truck was being serviced.

 

The In-Date and the Out-Date variables indicate the start and end date of the period of time within which the truck was taken off line for service, but not necessarily serviced on each and every day within that span of time. The “Pattern” value indicates which days within the indicated time span that the truck actually received service.

 

The “Pattern” variable is a string variable in the form of “123.567” or “…456.” or “……7” or any such variation, where the number corresponds to the weekday (with a “1” indicating “Monday” and a “2” indicating a “Tuesday” etc.) and the periods within the pattern indicating a day when the truck was not being serviced. So, for example, if a pattern value is “12.4567” then we know it was in the garage for every day of the week, except for Wednesday. More, a value of “12345..” indicates that the truck had the weekend off.

 

Hint: This challenge can be solved with and without the use of a macro

Kenda
16 - Nebula
16 - Nebula
Spoiler
Date-Time Parse KReW & Generate Rows to the rescue! 

Kenda_0-1647276108913.png

 

RolandSchubert
16 - Nebula
16 - Nebula
Spoiler
310.jpg

Decided to solve  without macro

joelmiller66
9 - Comet
Spoiler
310 screenshot.png
binuacs
20 - Arcturus

  

binuacs
20 - Arcturus
Spoiler
binuacs_0-1647280408521.png

 

patrick_digan
17 - Castor
17 - Castor
Spoiler
patrick_digan_0-1647281456844.png

 

Luke_C
17 - Castor
Spoiler
Luke_C_0-1647281916109.png

 

chiomaisaiah
6 - Meteoroid

 

Spoiler
Solved without a macro

chiomaisaiah_1-1647285636924.png

 

 

EW
11 - Bolide

This one is fun!  Here's my non-macro solution:

 

Spoiler
Capture.PNG