Weekly Challenge

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

We're actively looking for ideas on how to improve Weekly Challenges and would love to hear what you think!

Submit Feedback
We've recently made an accessibility improvement to the community and therefore posts without any content are no longer allowed. Please use the spoiler feature or add a short message in the message body in order to submit your weekly challenge.

Challenge #86: Create a Macro that Generates Past Dates

Highlighted
Alteryx Community Team
Alteryx Community Team

Last week's solution can be found HERE!

 

Create a macro that generates a table with the date and the day of the week for all dates from a given starting date to today. The user should be able to select the start date.

Bonus 1: Add a selection that will allow the macro user to select whether or not to include weekends.
Bonus 2: Create a duplicate macro that's encrypted so that no changes can be made. Leave the first macro on your canvas unencrypted so other challenge-takers can observe how your macro was built.

Highlighted
Alteryx Certified Partner

Attached Macro

 

Spoiler
Untitled.png
Highlighted
Alteryx Certified Partner

Solution attached.  Interested to see how people handled the skipping the weekends.

Highlighted
14 - Magnetar
14 - Magnetar

First time attempting the weekly challenge! I attached my macro (both encrypted and not) to this post.

 

EDIT: When I am creating the macro, I can use this expression in the Generate Rows tool for the Initialization Expression: "%Question.StartDate%" to get the initial start date from the date interface tool. However when I run the macro, I noticed that the initialization expression somehow automatically gets changed to whatever I set the value to in my workflow configuration. Does anyone know why this happens?

Highlighted
Alteryx Certified Partner

Making the workflow was quick, but converting it into macro was a bit challenging as I am not using Interface tools a lot.

 

Spoiler
Screen Shot 2017-09-18 at 17.46.26.png

 

 

Highlighted
14 - Magnetar

This one was relatively quick/easy for me - but mostly because I have a lot of exposure to dates and table creation.

Spoiler
I was able to get this done in four tools (excluding interface).  Generate Rows->Formula->Filter->Output.  Curious if there's a way to remove the filter tool with a more complex Generate Rows formula, and which option is more performant.
Highlighted
16 - Nebula
16 - Nebula
Spoiler
Generate Rows > Formula > Filter
Capture.PNG
Highlighted
14 - Magnetar
14 - Magnetar

My solution! Ah, it feels good to finally be caught up on Weekly Challenges after my 3-week vacation... Which, if I use this spiffy new macro, I can use it to see a list of exactly which days I was on vacation! Cheers!

 

Spoiler
Included Bonus 1 & 2 in the attached workflow! 🙂
WeeklyChallenge86.JPG
Highlighted
14 - Magnetar
14 - Magnetar

I had hoped to leverage the Detour tools, but they were throwing errors at me, so went another route. This way took fewer tools in the end, but the Detours make more logical sense. If I get that method working, I'll post too.

Happy with the efficiency of only 3 main tools in the workflow + 2 interface interactions +1 action + 1 output.

And I learned something new and powerful!! Didn't know one could encrypt macros. 

Spoiler
Generate Rows tool generates all of the dates between the chosen date and today

Then, a Date Time Parse tool creates the Weekday column (%A is the custom format)

Finally, a check box (when checked, macro will skip weekends), that feeds its value into a filter. When the checkbox is true, the weekend days are filtered out, and when false, all dates show. IIF took care of that for me. I wasn't sure if I could have just the field itself in the "value if false" so I used !IsNull([Day of Week]) to show all days of the week.

image.png
Highlighted
7 - Meteor

My first macro and my first challenge!