Take the 2-minute tour ×  What I have is a LineItem object and a
collection called LineItems that holds LineItem objects. My
LineItem objects have a property called ItemDate (DateTime data
type) and another property called ItemAmount (decimal data type)
and another property called ItemCategory (integer data type).
What I am trying to do is write a function in my collection
object that will return the integer category in whichever
category has the highest sum(ItemAmount) of that category. For
example, if I had this:  Object 1:    Object 2:    Object 3:
OK so in this example, the function should return 2 since
ItemCategory 2 had a bigger ItemAmount (535) than ItemCategory 1
(50+25 = 75).  This I know how to do. What makes it harder
though is I need it to be able to do this over time, meaning, if
an amount has a large amount, like 535, but some other objects
have smaller amounts, but there are more of them to closer
dates, then it needs to be techically "larger" than the other
amount. It is almost like the a