Need help - Program Indicator - Use most updated date when we combine two stages

Hi All,
I have a program with many stages, each stages can take place on different days.

  • Stage A
    Date: 17/06/2020

  • Stage B
    Date: 21/06/2020

Program Indicator:
indicator_name = element.StageA & element.StageB
Analytics period boundaries: event date
expression: V{enrollment_count}

On Pivot table i choose report period 19 to 21, how can i ensure that this will count, even if the stage A is not in that period. In other words, can I guarantee that the indicator takes the most recent date in the union of the stages?
Thanks