This sounds like the sort of thing that is better suited to a Dynamic Calc formula, strategically placed on a UD8 member, reacting to an Annotation-type View member. You then just reference the intersection in a regular Extensible Document field.
Very rough example:
If api.View.IsAnnotationType() Then
Dim diff as Decimal = api.Data.GetDataCell("T#2024 - T#2023").CellAmount
If diff > 0 then
return "Profit"
else
return "Loss"
End If
End If
Return Nothing
Extensible Documents are not meant for calculations; they are meant to embed data that has already been calculated by the engine.