Now we need to bring the two steps together again. It is tempting to click on the little “+” next to either of the steps and add a join, but Tableau Prep has a nice little feature where you can drag and drop elements to connect them.
In this case, drag your Aggregate step down to your first step until you see the orange drop areas and release it on top of “New Join” (NOT New Union).
If you look in the configuration, you will see something similar to the screenshot below. Tableau Prep should detect that you want to join on Country (after all, it’s the only dimension in your second data set).
You will also notice that the total number of records in the full data set equals the join result; we didn’t filter anything or change the level of detail for our main data set, so this is what we want to see. If these numbers are different, it is an indication that something went wrong.
If we look at the data grid in Tableau Prep, we can now see something similar to the initial table on the top of this post. Every country has their record-level sales in one column and the sum of all sales for that country in a second column. The sum of sales is the same for each record for a given country.
Note: In the image below, it doesn’t add up correctly because there is a lot more data which doesn’t appear in the screenshot.
If your data is now fully prepped and ready for analysis, simply add an output step and run the flow to generate the new data set.