Group by date and summarize number of pages
I have a table that records each book read, the user, number of pages read and the date. I have used
summarize
for displaying the total number of pages read and also used ->defaultGroup
to group by month and year. This looks great, but the summarize result is not correct.
As you can see on Date: Dec 2020
the sum of pages shows 243
, which is not correct.2 Replies
I found a solution for my issue: The problem when grouping is that Filament expects an ID column when displaying the data in a table.
However, as we know, when we group rows according to a particular field, we don't need the ID of a row. To fix this, we need to create a new field ID that will be formed by the number of total grouped roles.
That can be done through SQL like this:
Hi, I hope you dont mind me jumping on this:
I wanted to group by Year only.
the sum works but the date column shows the same year in each row. any ideas?