LibreOffice pivot table group by month
I'm not sure whether this was possible in LibreOffice that was current in the time when this question was asked but now this is quite easy to do, so if anyone stumbles upon this question this might help:
Using data from the input table (btw. for this last column "Month" is redundant) one should do the following.
Create Pivot table:
- Select the table and from the menu select
Data > Pivot Table > Create...
- In the
Column Fields
is theDate
field - In
Row Fields
is theCustomer
field - In
Data Fields
theAmount
field
When the Pivot table is created:
- Select/click on any cell in the row which contains dates
- From the menu select
Data > Group and Outline > Group
- Select
Group By > Intervals
- Check
Months
(or any interval you would like)
I think the problem is that the "Month
" column has different values for each date. So LibreOffice doesn't understand you want to group the output by distinct months.
Thus, a solution could be to "construct" a date based on cell A2, ignoring the day:
Replace the Formula "
=A2
" in the "Month
" column by=DATE(YEAR(A2),MONTH(A2),"1")
This way, you will have the same date for every month cell, depending on the original date.
Then, format that column using the pattern "
MMMM
" to display the date as "January
".Now, refresh the Pivot Table or re-create it with "
Month
" in "Column Fields
", "Customers
" in "Row Fields
" and "Sum - Amount
" in "Data Fields
".
This should yield the desired result.