First do the dedicated command to delete all inactive Track Versions using the command for that:
Project>Track Versions>Delete Inactive Versions of All Tracks .
This two line PLE should operate on all parts and events.
Container Type = Part OR
Container Type = Event
Function: Delete
The only boolean needed here is the OR in the filter pane.