Can you upload some dataset so that we can look into it?
thank you for the message. Please have a lot at my edited post now
Start out by pivoting the Code and SubCode fields. Here's how: 3 Ways to Pivot Data for Tableau - Ken Flerlage: Analytics Architecture, Strategy, & Visualization
It should now look like this. Note: I change Pivot Field Names to Code Name and Pivot Field Values to Code Value.
Now, flip over to your sheet, right click on Values and change it to a dimension.
Next create a calculated field, which I'll call Times:
CASE [Code Name]
WHEN "Code 1" THEN [Time 1]
WHEN "SubCode 1" THEN [Time 1]
WHEN "Code 2" THEN [Time 2]
WHEN "SubCode 2" THEN [Time 2]
WHEN "Code 3" THEN [Time 3]
WHEN "SubCode 3" THEN [Time 3]
WHEN "Code 4" THEN [Time 4]
WHEN "SubCode 4" THEN [Time 4]
Then build your view.
See attached sample workbook.
Sample.twbx 18.3 KB