2022: Week 36 - Calendar Conundrum

Challenge by: Jared Flores

After beginner and intermediate months, it felt like time to give Carl a break! So here's a challenge submitted by Prep Star Jared:

As part of managing your store, you need to know which days you have coverage and which days you still need to schedule. When plugging your data into Tableau to create a calendar, you get this view because you’re missing dates:


Timeline

Description automatically generated



We need to modify the data so that even dates with no coverage show in the view:

Diagram, timeline

Description automatically generated

Input

  • Employees and their scheduled dates

Table

Description automatically generated

 

Requirements

  • Input the data

  • The main challenge is to solve this using only employee_data input

  • Create a Calendar Table

    • Create a date range for the calendar

      • This should be dynamic to handle new data

      • The start of the range should be the based on the year of the earliest date

        • If earliest date is 06/01/2021, the start date should be 01/01/2021

      • The end of the range should be the last day of the year for the latest date in the data set

        • If the latest date is 06/01/2022, the end date should be 31/12/2022

    • Generate a row for every day between the start and end date to get a calendar table

  • Create a field containing the full name for each employee

  • Get a unique list of employees with their full name, first/last name fields, and employee id

  • Join the list to the calendar table

    • You should have a table with one row per employee per day

  • Join the new calendar table to the main table

    • One row per employee per day, even on days where the employee wasn’t scheduled

  • Create a flag if the employee was scheduled on the day

  • Handle any null values

  • Output the data

Output

A picture containing table

Description automatically generated

 

  • 6 fields

    • Scheduled_date

    • Emp_id

    • Full_name

    • First_name

    • Last_name

    • Scheduled

  • 7300 rows (7301 including headers)

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 @VizWhat

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