/api/analytics not returning values for the correct period

Hi ,

We are using the /api/analytics api to get the analytics data for a particular period using the dimension filter. The following is the call we are making ,

/api/analytics?dimension=dx:someid&dimension=pe:THIS_YEAR

Though the period specified using the ‘pe’ parameter is ‘THIS_YEAR’ , the data is being returned for the year 2014.

 The same error can also be seen in the data visualizer. In the data visualizer screen , changing the period filter to 'This year' and clicking on update , shows the data of the previous year i.e 2014.
···

Sandesh DoolipetaApplication Developer
Email
sandeshd@thoughtworks.com

Telephone
9686062727

Hi Sandesh,

this is not a bug and intended behavior, although some would call it a bit strange.

Currently the way it works is that we subtract 1 month from the current date before calculating the relative periods. So this year becomes 2015 on Feb 1, this quarter becomes 2015Q1 on Feb 1, etc.

We have done it because of the nature of routine data. When you create e.g. a chart with “this month” or “last year” or whatever, in most situations you don’t want the chart to “switch” period until after some time, because you will not have any data for that period immediately, as people cannot enter routine data before the period is over.

Example: If you collect data quarterly, e.g. for quarter 2, you cannot enter routine data before that quarter is over, and it also takes a bit of time to get people to enter data into the system. So if the system switches “this quarter” exactly at the day quarter 2 is over, all charts in your dashboard will become empty and boring for a long time.

That’s why we made it like that.

I know it is not satisfying all scenarios. We have been thinking of a way to explicitly define a “time lag” per chart/pivot/map where you can define this yourself, and we go back to having the relative periods “switch” on the day the period ends.

regards,

Lars

···

On Fri, Jan 9, 2015 at 11:37 AM, Sandesh Sukumar Doolipeta sandeshd@thoughtworks.com wrote:

Hi ,

We are using the /api/analytics api to get the analytics data for a particular period using the dimension filter. The following is the call we are making ,

/api/analytics?dimension=dx:someid&dimension=pe:THIS_YEAR

Though the period specified using the ‘pe’ parameter is ‘THIS_YEAR’ , the data is being returned for the year 2014.

 The same error can also be seen in the data visualizer. In the data visualizer screen , changing the period filter to 'This year' and clicking on update , shows the data of the previous year i.e 2014.


Sandesh DoolipetaApplication Developer
Email
sandeshd@thoughtworks.com

Telephone
9686062727

A questions to this: if the reasoning is that you would not want to switch to a new period until after some time, how come for example «Last quarter» changes to showing you the the current quarter before the quarter is over i.e. the opposite of this?

Olav

···
  1. jan. 2015 kl. 11.49 skrev Lars Helge Øverland larshelge@gmail.com:

We have done it because of the nature of routine data. When you create e.g. a chart with “this month” or “last year” or whatever, in most situations you don’t want the chart to “switch” period until after some time, because you will not have any data for that period immediately, as people cannot enter routine data before the period is over.

Sorry I got it a bit wrong.

All relative periods (except weekly) "switch over" one month after the
*start* date of the relative period, not the end.

The reasoning is the same. Often data is entered monthly. If you create
e.g. a chart with "this quarter", which aggregates the monthly data into a
quarter", the system waits a month until you have at least some data in the
system before switching the quarter for the chart.

Still, this means that:

  1. «Last quarter» (and to some extent «Last 4 quarters») cannot be used for quarterly routine data, which is probably the second most common period type, since any report would then be empty two thirds of the time.

  2. Regarding monthly datasets being aggregated:

  • if what you need is a report for the quarter, which is common a lot of places I think, you will have to wait until the end of the quarter anyway.

  • if you want to get data for the quarter before it is finished, then «last month», «last 3 months» or «last bi-month» are all alternatives. For quarterly data, on the other hand, there are no real alternative except using fixed periods, which is not useful for dashboards or easily reusable favorites.

There are of course cases where you actually want to get a report for «so far this quarter», which is what you get currently, but I find it hard to believe that it is the most common use case, and that the benefits of having that outweigh all the downsides. And with anything tracker-related, the assumption about data being monthly does not make sense.

If all period types had both «last» and «current» as options, and they actually gave you the last and current periods, I think it would make things a lot easier.

···

Sorry I got it a bit wrong.

All relative periods (except weekly) “switch over” one month after the start date of the relative period, not the end.

The reasoning is the same. Often data is entered monthly. If you create e.g. a chart with “this quarter”, which aggregates the monthly data into a quarter", the system waits a month until you have at least some data in the system before switching the quarter for the chart.