Grouping data by month and year for visualisation

Hi there,

New to redash and would like some help with a simple visualisation as I’m struggling. :sweat_smile:

I have a mongodb query that grabs all the transaction data in my database and projects three attributes:

  1. _id
  2. the type of transaction
  3. date the transaction was created

I want to be able to group all the transactions into month/year and then display them in a stacked bar chart. Is there a simple way of achieving this? Or should I group all the transactions by month/date in the query?

Thanks in advance!


SELECT "type", COUNT(_id), strftime('%Y-%m-01', transaction-date) "date"
FROM query_xxxx GROUP BY 1,3