2024: Week 16 - Solution
Solution by Tom Prowse and you can download the workflow here.
Step 1 - Clean Actuals & Budgets
The first step is to input the Actual and the Budget tables so that they are separate branches in our workflow. We want to combine these branches but first we need to clean each table so that they join nicely.
Actual
For this branch we just need to make a change to the 'TransactionFees' value in the 2022 field and make sure there is a space between the two words - 'Transaction Fees'.
Budget
For this branch we need to make a few changes to the Budget field so that the numbers are all formatted correctly as a number instead of a string. To do this we can duplicate the Budget field, then remove all letters from this field using the Clean functionalities in Tableau Prep
From here we can change this to be a whole number and then use the following calculation to format the budget numbers correctly:
Budget
IF ENDSWITH([Budget],'K')
THEN [Budget-1]*1000
ELSE [Budget-1]
END
We can then remove the Budget-1 field and the table should look like this:
Step 2 - Combine Tables
We're now ready to combine the tables into a single table. For this we can use an inner join on the 2022 field. This will combine the tables so that the 9 rows in each match:
After the join we then need to remove any duplicated fields and rename the Budget field to Forecasted Spending and Actuals to Actual Spending.
The last task is to calculate the variance between the Actuals and Budgets by calculating the difference:
Difference
ROUND(
[Actual Spending]-[Forecasted Spending])
We are then ready to output our data that should look like this:
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!