I have the following formula:
sum(aggr(FirstSortedValue([Stock_Value],-Date),Number.Product))
The formula gives me per product the value from the last available date.
The formula should now also take the Date_ID_number (highest Date_ID_number) into account in addition to the date.
Furthermore only certain years should be able to be taken into account. e.g. per product last stock_value from 2021 .
How can I do this?