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 #17: Month-over-Month Retention Rate

Alteryx Alumni (Retired)

Here is this week’s challenge, I would like to thank everyone for playing along and for your feedback. The link to the solution for last challenge #16 is HERE. This week’s assignment is listed as an advanced exercise due to the requirement of using a batch macro for the solution.

The use case: A bank is looking to calculate customer retention rate month over month. The denominator in the calculation are all of the accounts open 24 months prior to the start of the month. For example, for June 2013, the denominator would be the total number of accounts open between June 1, 2011 through May 31, 2013. The numerator will be total number of accounts closed in June 2013 or between June 1, 2013 through June 30, 2013.

The objective is to create a batch macro that calculates the retention rate for May, June, July and August.

Alteryx Alumni (Retired)

Spoiler
Tara McCoy
11 - Bolide

It's nice to see the macro answer and learn something new!  I got stuck on this one since I was trying to do it without adding a start of month table and I have very little experience with macros.  I was able to solve it without using a macro and without having to manually add a Start of Month table.  I had one hard coded filter to remove activity prior to May 2013 so that my results matched the same date ranges shown in the solution.  It doesn’t really need to be included to make this work.  The 24 month criteria for calculating the numerator (open accounts from prior 24 months) is also hard coded based on the directions.  Everything else is dynamic so that if you had accounts older than 24 months they would not be included in the calculation nor would you need to add a record in the Start of Month table to include September 2013.  I annotated the best I could while trying to keep the canvas clean.  I could have added tool containers, but I need to move on.  I chopped it into 2 pictures so that it is legible.  I’d be happy to answer any questions on the workflow formulas.

Spoiler

17 - Castor

Quite a different approach within the Batch macro from @GeneR's (or @TaraM's) solution, but the inputs to the batch macro are very similar.

Spoiler
- Added a set of fields to make maintanability easier and the logic more obvious:
- One for the control param being the month in question
- one for a date 24 months previous
- one as a boolean flag to say "is this account open right now"
- one as a flag to say "did this account close in the window in question" etc
- Then we just take a sum across these flags
- Then, same as @GeneR / @TaraM, calculate the ratio and send out to the calling macro

I didn't use the control param through an action component - but instead straight into a formula

ACE Emeritus

My solution. Watched the webinar on Batch Macros today, so this one was perfect practice :) Pretty pleased I was able to do this one in just a few tools!

Note: The instructions indicate numerator is Open & denominator is Closed, but then results in the start file have it showing calculated as the opposite. In addition, I believe to be accurate with identifying a true "Retention Rate," you'd want to know the # of customers remaining after closed accounts... so wouldn't it be (Open - Closed)/Open? Just a thought. I solved for both in my solution, just in case!

Spoiler
15 - Aurora

11 - Bolide

Here is my solution!

8 - Asteroid

This one was a struggle for me, but finally managed to solve and it looks to be similar to other solutions.

Spoiler
15 - Aurora

I had to look at the solution for this to help get my Open/Close formula correct :(

Spoiler
17 - Castor
Spoiler