alteryx Community

# 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.

## Challenge #310: Maintenance Schedule

Alteryx

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

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

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

16 - Nebula
Spoiler

Decided to solve  without macro

9 - Comet
Spoiler
20 - Arcturus

20 - Arcturus
Spoiler

17 - Castor
Spoiler

17 - Castor
Spoiler

6 - Meteoroid

Spoiler
Solved without a macro

11 - Bolide

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

Spoiler