Hello,
If I would have a table like this:
If I would want to get the total amount per product_type AND per month (based on purchase_date), how would I achieve that?
The expected result should look something like this:
{
productsByAmount: [
{
product_type: Book,
amountByMonth: [
{
month: Jan 2023,
amount: 83.94},
{
month: Feb 2023,
amount: 57.39}
]},
{
product_type: Pen,
amountByMonth: [
{
month: Jan 2023,
amount: 9.80},
{
month: Feb 2023,
amount: 12.90}
]},
...
Etc.
Any ideas?
Thank you!