7 Replies Latest reply: Feb 17, 2016 8:48 AM by Sunny Talwar

# Aggregated sum by max date

Good day!

I have some source:

 Id Date Sales 1 15.02.2016 45 1 16.02.2016 654 2 15.02.2016 54 2 16.02.2016 1 3 15.02.2016 45

I expression i need to calculate Sales by Id. if some Id has more then one Date, expression must get max date.

Thanks.

• ###### Re: Aggregated sum by max date

Try FirstSortedValue(Sales, -Date)

• ###### Re: Aggregated sum by max date

Implementation of Gysbert's suggestion:

• ###### Re: Aggregated sum by max date

Thank you!

Can i use filters inside this expr?

• ###### Re: Aggregated sum by max date

You sure can

• ###### Re: Aggregated sum by max date

You can add set analysis to FirstSortedValue function:

FirstSortedValue({<Field = {'Something'}>} Sales, -Date)

• ###### Re: Aggregated sum by max date

The expression is:

FirstSortedValue(Sales, -Aggr(Max(Date(Date#(Date,'DD.MM.YYYY'))),Id,Date ))

But you have to take care of your field "Date", is better if you put in the correct format.