Skip to content
Advertisement

How to Count Entries on Same Day and Sum Amount based on the Count?

I am attempting to produce Table2 below – which essentially counts the rows that have the same day and adds up the “amount” column for the rows that are on the same day.

enter image description here

I found a solution online that can count entries from the same day, which works:

enter image description here

It is partially what I am looking for, but I am having difficulty trying to display all the column names.

In my attempt, I have all the columns I want but the Accumulated Count is not accurate since it counts the rows with unique IDs (because I put “id” in GROUP BY):

enter image description here

I’ve been working on this for days and seemingly have come across every possible outcome that is not what I am looking for. Does anyone have an idea as to what I’m missing here?

Advertisement

Answer

Cumulative sum and count should be calculated for each day

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement