2023: Week 9 - Customer Bank Statements

Challenge By: Jenny Martin

Welcome to our first ever advanced month! You've been building your skills over the last couple of months and now you're ready to put your new found data preparation skills to the test. Please don't lose heart if you find this challenge tough, it's designed to be! I'll leave a hint to a previous challenge that uses a similar technique to help you along your way.

Data Source Bank usually waits until the end of the month to let customers know their bank account balance. Customers want more control and the ability to see how their balance changes after each transaction. Let's create bank statements for them!

Inputs

The data for this week should feel very familiar! We used this data already in week 7, but we'll only need 3 of the 4 tables this week.  
  1. Transaction Path 

  2. Transaction Detail 

  3. Account Information 

Requirements

Note: I found doing this in 2022.4.1 caused a bug. However, it worked in 22.3 so consider going back to non-wavey lines for this challenge! Update: the bug is fixed in 2022.4.2!
  • Input the data
  • For the Transaction Path table:
    • Make sure field naming convention matches the other tables
      • i.e. instead of Account_From it should be Account From
  • Filter out the cancelled transactions
  • Split the flow into incoming and outgoing transactions 
  • Bring the data together with the Balance as of 31st Jan 
  • Work out the order that transactions occur for each account
    • Hint: where multiple transactions happen on the same day, assume the highest value transactions happen first
  • Use a running sum to calculate the Balance for each account on each day (hint)
  • The Transaction Value should be null for 31st Jan, as this is the starting balance
  • Output the data

Output

  • 4 fields
    • Account Number
    • Balance Date
    • Balance
    • Transaction Value
  • 20,378 rows (20,379 including headers)
You can download all the output from here

After you finish the challenge make sure to fill in the participation tracker, then share your solution on Twitter using #PreppinData and tagging @Datajedininja@JennyMartinDS14 & @TomProwse1

You can also post your solution on the Tableau Forum where we have a Preppin' Data community page. Post your solutions and ask questions if you need any help! 

Popular posts from this blog

2023: Week 1 The Data Source Bank

2023: Week 2 - International Bank Account Numbers

How to...Handle Free Text