We’ve extended Inspire Early Bird Pricing until March 1. Register now and enjoy 20% off conference passes and 10% off training passes. P.S. Don’t forget to bring friends! When you sign up for five or more tickets, you get an extra 20% discount on conference passes. Learn more now.

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 #86: Create a Macro that Generates Past Dates

JoeM
Alteryx Alumni (Retired)

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.

gnans19
11 - Bolide

Attached Macro

 

Spoiler
Untitled.png
nick_ceneviva
11 - Bolide

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

Kenda
16 - Nebula
16 - Nebula

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?

Natasha
9 - Comet

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

 

 

Claje
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.
patrick_digan
17 - Castor
17 - Castor
Spoiler
Generate Rows > Formula > Filter
Capture.PNG
NicoleJohnson
ACE Emeritus
ACE Emeritus

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
estherb47
15 - Aurora
15 - Aurora

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
elamm43
7 - Meteor

My first macro and my first challenge!