Display latest month data and same month data of previous years

(Swapnil Pimple) #1

Hello.
I am having data of years 2012, 2013, 2014, 2015, 2016, 2017, now wanted to make such a report where it will give numbers for latest month (lets say Nov 2017) and data for same month of previous years ( Nov 2016, 2015, 2014, 2013, 2012 data).

0 Likes

(Andrew Powell) #2

You can do this by utilising the “month_name” or “month_num” timeframes - read more here.

dimension_group: order_created_at {
    type: time
    timeframes: [date, week, month, month_name, month_num]
    sql: ${TABLE}.order_created_at
}

The month timeframe gives the full year-month string “2017-11” whereas the month_num and month_name timeframes just give 11 or “Nov” respectively.

To build the report you can filter on the month name or number and set it to November, then add month to the report and select whichever metric you’re looking for. This will give you the report you are looking for.

Best,
Andy

1 Like