I feel silly asking this because it seems simple, but I concede and need some help. In BigQuery I have a Table that looks like this:
What I’m trying to accomplish is groupby month. So I’m looking to create a table that has each portfolio and super discipline and month (date) uniquely in a row with the sales and units for that month and those attributes summed up.
If it helps, if I was in Python I would simply replace the Date column with the months and then type
I think my biggest issue is that the date column is in days, so when I convert it with “FORMAT_DATE(‘%Y-%m’, Date) AS Date” I can’t groupby it. Thanks in advance.
select format_date('%Y-%m', Date) as month, Portfolio, Super_Discipline, sum(Dollars) as Dollars, sum(Units) as Units from your_table group by month, Portfolio, Super_Discipline