2022: Week 45 - Strange Table Structure

 Challenge by: Jenny Martin

This week we're working with a dataset that's very easy for humans to read, not so easy for Tableau. Let's restructure it to make it Tableau friendly. Warning in advance: this may involve creating many separate branches in your work flow!

Input

In this dataset, we have the Months going along the top of the table. The row below then gives the Sales and Profit measures for that Month. 

Requirements

  • Input the data
  • Split off the Year from the first row of data
  • Pivot the remaining rows 
  • Remove the 'F' from all of the F1, F2 etc field names so we have row numbers
  • Reshape the data so each row has a Month associated with it
  • Reshape the data so the values fall under either Sales or Profit
  • Create a Date field using the Month and Year fields
  • Output the data

Output


  • 4 fields
    • Store
    • Date
    • Sales
    • Profit
  • 40 rows (41 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

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