community
cancel
Showing results for 
Search instead for 
Did you mean: 
Announcement | Get certified today - take the Alteryx Designer Core and Advanced exams on-demand now!
Do you have the skills to make it to the top? Subscribe to our weekly challenges. Try your best to solve the problem, share your solution, and see how others tackled the same problem. We share our answer too.
Weekly Challenge
Do you have the skills to make it to the top? Subscribe to our weekly challenges. Try your best to solve the problem, share your solution, and see how others tackled the same problem. We share our answer too.
Unable to display your progress at this time. Please try again a little later, or contact an administrator if you continue to see this error.

Challenge #106: How Long were the Lights On?

Director, Customer Enablement
Director, Customer Enablement

Last week's solution can be found here:

This week, we have a simple data set that represents times that inhabitants enter and exit rooms within their household. Assuming inhabitants have the lights of the room on whenever they are present and off when they are not (think motion detection), how many minutes were lights on in each of the rooms?

house lights.gif

 

Note: If there are overlapping time entries, assume the light is on as long as someone is present in the room.
Example: Person 1 is in the room from 12:30 PM - 1:30 PM, and person 2 is in the same room from 1:00 PM to 2:00 PM. The amount of time the light was on was from 12:30 PM to 2:00 PM (do not count duplicate time).

Alteryx Certified Partner

 

Spoiler

Trickier than I thought until I realised that DateTimes would be easier to work with than Times. Managed to solve this with two tools in the end:


Screen Shot 2018-03-05 at 21.08.02.png

 

 

Two-tool solution! :)

 

Spoiler
Challenge106.JPG

Cheers,

NJ

Alteryx Certified Partner

Here is my totally overcomplicated solution, just because 

 

Spoiler
I didn't want to use Generate Row tool, thinking that on a real size data generating every minute would create a massive dataset, also it seems like a direct solution and I was interested to find if there is another way. And of course it is with Alteryx!

Could also do it in two tools but then my already hard-to read formula in multi-row tool would be even worse, so I decided to leave 3 tools.
 

Screen Shot 2018-03-06 at 00.55.34.pngScreen Shot 2018-03-06 at 00.57.56.png
Highlighted
Asteroid

Here's my pass at it!

 

Spoiler
No Generate Rows or complex Multi-Row formula when I was trying, but its neat to see all the ways other people trimmed the fat in their solutions!
Screen Shot 2018-03-05 at 6.36.29 PM.png

 

 

I guess it's one of those times where the straight forward solution wasn't coming to mind...

 

Spoiler
Capture.PNG
Alteryx Certified Partner
Alteryx Certified Partner

Got there eventually

 

Spoiler
workflow image time.png
Magnetar
Magnetar

Solution attached.

 

Spoiler
I'm not sure if my method is the most optimal or not - basically I created a distinct record for each minute that existed and then used a pair of summarize tools.  You could also use a count_distinct and cut the second summarize.
Asteroid

This was harder than I expected.

 

Spoiler

 

106.JPG

 

Alteryx Certified Partner

Hello,

 

Challenge #106 resolved.

Please find my workflow-solution attached.