community
cancel
Showing results for 
Search instead for 
Did you mean: 
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.
Getting started with Designer? | Start your journey with our new Learning Path!

Challenge #86: Create a Macro that Generates Past Dates

Director, Customer Enablement
Director, Customer Enablement

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.

Alteryx Certified Partner

Attached Macro

 

Spoiler
Untitled.png
Alteryx Certified Partner

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

Pulsar
Pulsar

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?

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
Magnetar
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.
Spoiler
Generate Rows > Formula > Filter
Capture.PNG
Magnetar
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
Pulsar
Pulsar

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
Meteor

My first macro and my first challenge!