2023: Week 24 - Solution
Solution by Tom Prowse and you can download the workflow here.
This is the second part to the challenge from Andreea Scintei from last week. We are taking it a further and doing some more analysis on the students.
Step 1 - Group Grades
We want to input the Results table and then we can transform the shape by using a pivot step to pivot the subjects from columns to rows:
Once we have the subjects in a single column, we can use the Tile function to make the groups based on subject and grade
The table should now look like this:
We can then join the Tiles input table to our workflow so that we can then replace the group numbers with the associated label.
Join the tables with an inner join where Group = Number:
We can then tidy the table so that it looks like this:
Step 2 - Combine Student Info
We can now combine our final table, but first we need to ensure that our current workflow is in the correct shape. Although we pivoted our table previous, we can now pivot it back the other way by using a rows to columns pivot on the subject and Max Range:
We can then prepare the Student Info table by ensuring that there are no leading or trailing spaces in the Class field by using the Trim Spaces function
Now we can join the tables with an inner join on Student ID:
After the join the table should look like this:
Step 3 - Lower Quartile Flag
Finally we want to create a flag that highlights any student that is in class 9A or 9B and is in the lower quartile for 2 or more subjects. We can calculate the flag with this calculation:
Flag
IF
([Class] = '9A' OR [Class] = '9B')
AND
(
(CONTAINS([English],'25') AND CONTAINS([Economics],'25'))
OR
(CONTAINS([English],'25') AND CONTAINS([Psychology],'25'))
OR
(CONTAINS([Economics],'25') AND CONTAINS([Psychology],'25'))
)
THEN 'Yes'
ELSE 'No' END
Then we can filter the results based on the Yes values so that the final table looks 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!