distinct values
1 TopicHow to calculate sum of values by last date and distinct key
Hi! 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: Key Value Date a 1 1.1.2023 a 2 2.1.2023 a 3 3.1.2023 b 3 10.2.2023 b 2 20.2.2023 b 1 10.5.2023 c 5 5.2.2023 c 5 6.2.2023 c 5 23.5.2023 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) a 3 3.1.2023 b 2 20.2.2023 c 5 6.2.2023 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. Thank you Antti JärvinenSolved1.2KViews0likes3Comments