2022: Week 39 - Solution


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


This week we revisit a favourite challenge of ours... a fill down! We are looking to help the HR department fill in the missing information around key employee dates.

Step 1 - Employee Field

First we want to focus on the employee field. This will allow us to 'copy' the employee name down until there is another employee. 

The first step is to create a table with each of our employees and their ID. To do this we can remove the Null values from the Employee field, then remove the other fields so we are left with Employee ID (renamed from Record ID) and Employee:


From here we want to join this table back to our original workflow using an inner join where the Record ID >= Employee ID:


This allows us to join all of the rows where the record id is less than the employee id. This creates an expanded table, but we can then use some filters to ensure that the names are correctly labelled.

To ensure we are filtering correctly, first we want to find the Max number for each Employee ID using an FIXED LOD: 

Employee ID Match: 


We can then use this field to filter to keep the rows where [Employee ID Match]=[Employee ID], then we can remove the Employee ID Match, Employee ID, & Employee fields so the table looks like this: 


Step 2 - Work Level Field

Next we want to use the same technique to fill in the Work Level field. To do this we again want to create a table that includes all of the different levels and the IDs.

To do this we want to remove the Employee-1, Stage, and Date fields then filter the Work Level field to remove the null values. 


We can then do a join back onto the previous step. This time it's an inner join where Record ID >= Work Level ID 


Again, as a result of the join, we need to filter some of the results. First, we need to find the maximum ID for each Work Level: 

Work Level ID Match


Then we can filter to keep only values where [Work Level ID Match]=[Work Level ID], then remove any additional fields so that the table looks like this:


Step 3 - Reorder Data

The final task is to reorder the data so that it is in the same order as the input. For this we want to sort alphabetically by employee, and then by earliest date. We can do this using a Rank, note you will need to remove the existing Record ID: 

Record ID


After ordering in the correct way we can 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! 


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