2021: Week 42 - Solution

 


Solution by Tom Prowse and you can download the workflow here. 

This week's challenge took a return to the Allchains Bike Store for another challenge using the create new rows feature from the latest Tableau Prep release. The challenged focused on how we can make an estimation of how much money had been raised from a charity fundraiser where the data hadn't been recorded accurately.

Step 1 - Create New Rows

The first step is to input the data and then we can use the create new rows step to fill in any date that is missing between the first and last date in the data set. 

The setup required to create these new rows is as follows: 


We can use the values from the Date field, where the start date is the earliest date and the end date is the latest date, and we can update the existing fields when adding the new rows. This should be on a 1 day increment and the new rows should copy the values from the previous row. 

Our updated table should look like this: 


Step 2 - Various Calculations

The next step is to calculate the various calculations that are documented in the requirements.

Days into Fundraising 
This is to calculate how many days there have been between each row since the 1st Jan (the start date). We can use the following calculation: 

DATEDIFF('day',#2021-01-01#,[Date])

This will create a running total of the days for each row. 

Amount Raised per Day 
This is the total amount raised to date over the amount of days of fundraising there have been.

[Total Raised to date]/[Days into fund raising]


The last calculation is to calculate the amount raised on each weekday. Before calculating this we first need to covert our date field into the weekday format. To do this we can use the in-built 'Convert Dates' functionality where we can select 'Day of the Week' 


This will change each of the dates into 'Monday, Tuesday, Wednesday etc'. 

From here we can then calculate the avg raised on each weekday by using a fixed LOD:

Avg Raised per Weekday 



After this calculation we are ready to output the data that should look like this: 



You can download the full output 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

2024: Week 1 - Prep Air's Flow Card

2023: Week 1 The Data Source Bank

How to...Handle Free Text