I have a problem where I need to calculate sum (and average) of values, by only using the last applicable date (filtered by date-filter), and only using distinct keys related to the values.
Example of data:
Dates can be very randomly distributed (based on modification of data).
For example if user filter date = 1.3.2023, applicable rows would be: (last rows before that point of time)
Which would return 8 for sum.
I couldn't find a case with such complexity, only simpler sumx distinct examples, but I also need to dynamically consider which is the last applicable date by that point of time.