I am looking for a similar solution, but I think your approach has a flaw in it.
Due to the fact that you have to group by a numeric column ("TotalAmount_E"), in the case that you have two transactions that occur on the same day for the same amount only ONE will be counted.
Example data
Date Amount YTD
1/1/2015 100 100
1/2/2015 200 300
1/2/2015 200 300 <-- Same date, same amount NOT COUNTED
The level of uniqueness needs to be more detailed since the group by "AMOUNT" column can be duplicated and you WANT to count those too.
Regards,
Justin