I have found a (partial) solution - formula inside the reference line expression:
= FirstSortedValue ( daysSinceOpening,
-Aggr(
IF(SUM(Sales)<500, SUM(Sales), 0),
daysSinceOpening
)
)
This gives me the first day on which Sales was below 500.
However, this is calculated on a day to day basis. (Which does solve the problem mentioned by me in the question, but as it turns out not my initial problem).
When I want to find out the week (since store opening) on which sales was below 500 I encounter another problem of the function not returning any value anymore. Below you can see my function where I try to aggregate on a weekly setting:
= FirstSortedValue ( Floor(daysSinceOpening, 7),
-Aggr(
IF(SUM(Sales)<500, SUM(Sales), 0),
Floor(daysSinceOpening, 7)
)
)