Can someone help me with the syntax?

I am not sure why i am having such a hard time with this one but my brain is not putting the logic together very well.

I'm trying to create a calculated field where we are adding the total loan counts from 1st and 2nd mortages by date. Right now we have them split. I have been trying a fixed by function but I am not sure how to write the syntax for a group by date on this one.

Again, probably not too hard so TIA

If this helps, feel free to agree, accept or awesome it!