How to differentiate scope in calc expression?

entity type MyType schema name 'MYTYPE' {
  quantity: ExactDimension

  date: datetime

  parent: ParentType

  newQuantity: ~ stored calc "quantity - parent.myTypeHistory.(date < date)[0].quantity"
}

entity type ParentType schema name 'PRNTYPE' {

  myTypeHistory: [MyType](parent)
}

How do I differentiate in the filter between the date on the myTypeHistory and the date on MyType?

You can traverse the data model the same way you would normally:

newQuantity: ~ stored calc "quantity - parent.myTypeHistory.(date < parent.date)[0].quantity"

Actually it turns out what i am trying to do is not possible. The expression engine does not support it, as of now.

This might be relevant