Hi Tom,
You can't follow an if statement with a where, that's why you're getting the error.
We recently added two new keywords that should help you out: $showonce and $when
To use $showonce, you could use this:
$repeatRelatedDocuments where Package = Data Requirements
$showonce
Entity Relationship Model
$endshowonce
$Name
$endrepeatRelatedDocuments
To use the $when, it would be:
$whenRelatedDocuments where Package = Data Requirements
Entity Relationship Model
$listRelatedDocuments where Package = Data Requirements
$endwhenRelatedDocuments
The details on these new keywords can be found in the Custom Report User Guide. Please note - there is a slight issue with $when keyword right now, it will only work if it's nested within a $repeat or $Outline. We're planning on releasing a new update later today that will include a fix that will allow you to use the $when right at the top level.