The result could be obtained right in Tableau (Desktop)
by applying a Conditional Aggregate Filter.
The (row-level) filter calculation would be
IF [class] = 'PHY' THEN 1 END
The aggregation condition would be either SUM() > 0 or MAX() = 1
In Prep, there would be two steps (Aggregation and Join + Filter).
Please find the attached.