This site uses different types of cookies, including analytics and functional cookies (its own and from other sites). To change your cookie settings or find out more, click here. If you continue browsing our website, you accept these cookies.
We're actively looking for ideas on how to improve Weekly Challenges and would love to hear what you think!Submit Feedback
Last week's solution has been posted here.
This week's challenge explores the problem of Slowly Changing Dimensions, which some of you may be familiar with as you update existing or historical data with changes to those attributes. In this challenge, we'll be updating our log of Jedi rankings to reflect changes in Jedi levels, promotions, and retirements (yes, even the Jedi Knighthood has an HR department).
The challenge's Start file contains an input of the "Current Log", which includes data on an individual's level, when they started at that level, and when they completed that level. Records with an end date indicate either a promotion or a separation for that individual. The input "Today's Updates" includes the changes that take effect today: Bob has joined the Dark Side, Kaitlin and Richard have been promoted up the Jedi Ranks and Joe has joined the Jedi Knighthood. Your task: create a workflow that produces an updated list of the current Jedi ranks.
Fun Challenge! Made the assumption that if a record successfully joins on both name and level then it is being included and should be closed. This is how Bob's record drops out.
It is also good to verify the workflow logically, if Bob had more than one record in the Current Log, would it still work as expected?
Here are my two routes, one with mostly Multi-Row Formula tools, and another with mostly Joins.
- Union Current Log and Today's Updates
- Sort by Name and Start Date
- Multi-Row Formula updates End Date if Current Flag is "Y"
- Multi-Row Formula updates Current Flag if there is no next record for Name, then Current Flag is "Y" else "N"
- Filter to find "Y" Current Flag Records with an End Date
- Join by Name to remove records with those Names
- Join by Name, Level, Start Date. Names that join here can be removed
- Join by Name to remove the newly ended
- Formula on record that came out the Left of the first Join, add Flag Fields
- Join by Name, Current Flag. Records that Join need the Prior record to be updated. Left are record that need no change
- Union records to keep. 1. Existing records with no change needed. 2. New Records. 3. Existing records that needed changes
- Sort by Name and Start Date
"It's not impossible. I used to bull's-eye womp rats in my T-16 back home. They're not much bigger than two meters."
I must have been really slow. I couldn't understand the issue with Bob. Finally, I got it. I looked at how @NicoleJohnson solved hers and took it another direction. Her solution put light on the Bob issue. I won't say which runs faster, but since this is a slow exercise I'll say that NJ won that battle.
Solution attached. Added a 'Joined the Darkside' flag so that we could keep Bob's records but filter the traitor out when we want current Jedi details (this was based on there being an End Date in the update log).
Alteryx Certified Partner and Jedi HR Manager