You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@superset.apache.org by gi...@git.apache.org on 2017/09/27 10:00:59 UTC

[GitHub] nbonnotte opened a new issue #3538: Time window is not aligned with time grain

nbonnotte opened a new issue #3538: Time window is not aligned with time grain
URL: https://github.com/apache/incubator-superset/issues/3538
 
 
   - [x] I have reproduced the issue with at least the latest released version of superset
   - [x] I have checked the issue tracker for the same issue and I haven't found one similar
   
   ### Superset version
   
   v0.19.1
   
   ### Expected results
   
   Say I want to display the number of items purchased per week over the last 3 months with a bar chart. I choose a weekly time grain, and set the time window to start from "90 days ago"
   
   ![image](https://user-images.githubusercontent.com/9929982/30907043-ed8dcffe-a379-11e7-9104-05a552ddd3b9.png)
   
   I would expect the first bar, for the first week, to correspond to the number of items purchased for the whole week, not for the part of that week that happen to be within the 90-day time range.
   
   ```sql
   SELECT DATE_TRUNC('week', purchase_timestamp) AS __timestamp,
          COUNT(*) AS purchases
   FROM purchase_table
   WHERE DATE_TRUNC('week', purchase_timestamp) >= DATE_TRUNC('week', TIMESTAMP '2017-06-29 00:00:00')
     AND DATE_TRUNC('week', purchase_timestamp) <= DATE_TRUNC('week', TIMESTAMP '2017-09-26 00:00:00')
   GROUP BY DATE_TRUNC('week', purchase_timestamp)
   ```
   
   ### Actual results
   
   The first bar is truncated, and does not correspond to the whole week
   
   ```sql
   SELECT DATE_TRUNC('week', purchase_timestamp) AS __timestamp,
          COUNT(*) AS purchases
   FROM purchase_table
   WHERE purchase_timestamp >= '2017-06-29 00:00:00'
     AND purchase_timestamp <= '2017-09-26 00:00:00'
   GROUP BY DATE_TRUNC('week', purchase_timestamp)
   ```
   
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services