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 #117: Credit/Debit Midpoints

JoeM
Alteryx Alumni (Retired)

Last week's solution is now up - find it here!

 

This week, we are looking at a few accounts. In this set of data, there are 4 accounts. The first row of every account represents the number of credits/debits against the account, and the second row represents the actual credits and debits paid against the account in the order they were paid. Your task is to find the credits and debits where the sum of debits and credits BEFORE any transaction is equal to the sum of debits and credits AFTER it. Please count the transactions from 0 to match the answer. Below is a picture that illustrates the logic of which transactions should be captured. The picture represents the second account.

datapic.png

 

Sample logic:

samplepic.png

terry10
11 - Bolide

Joe, Typo - The challenge start file name says #116, not #117; also the header in the file needs to be correct too.

David-Carnes
12 - Quasar

@JoeM  was counting the challenges with a zero based index, just like THIS challenge. 

JoeM
Alteryx Alumni (Retired)

Updated!

@terry10  - Good catch!

@David-Carnes - Thanks for having my back ;) 

 

terry10
11 - Bolide

 

Because there are <10 accounts, I just used the multi-row tool, but I plan to re-do this with an iterative macro that would work no matter how many accounts there are.

 

 

Spoiler
117.JPG

 

NicoleJohnson
ACE Emeritus
ACE Emeritus

My solution! Practicing my speed-solving for the Grand Prix :)

 

Spoiler
Opted for a solution that calculates running total from Left-to-Right and then re-sorts to calculate from Right-to-Left, and then filtered for only those options that had the same total in both directions.
WeeklyChallenge117.JPG

Cheers!

NJ

 

 

MarqueeCrew
20 - Arcturus
20 - Arcturus

@NicoleJohnson,

 

I like the way that you eliminated the noise that @JoeM inserted into the problem.  I also learned from your use of the parse that instead of \s you could literally use a space character.  I don't like it, but it is possible.

 

Good luck in the Grand Prix!

 

Cheers,
Mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
NicoleJohnson
ACE Emeritus
ACE Emeritus

Thanks, @MarqueeCrew!

 

I periodically go rogue on the shortcuts with syntax, though probably not as intentionally as you might think haha... In this case, I didn't even think to use \s. It's been that kind of Monday. You get a gold star for catching onto that though! :)

 

NJ

MarqueeCrew
20 - Arcturus
20 - Arcturus

@NicoleJohnson,

 

Do you know why I would object to the use of the SPACE instead of \s?

 

It surely caught my eye.  

 

BTW, when I was solving this I was using a JOIN with the two sorted streams coming back together.  I find your solution more straight-forward.

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
NicoleJohnson
ACE Emeritus
ACE Emeritus

The space is not as obvious as the \s, for sure - it appears to be nothing, but is in fact something! Can't get anything (or nothing!) past you, @MarqueeCrew!