serenajiang opened a new issue #17020:
URL: https://github.com/apache/superset/issues/17020


   When you create a time series viz with a groupby and contribution `Total`, 
if at least one of the categories is missing a value for the date, no data 
points for that date are shown.
   
   This is sort of reasonable - technically, the data could be missing for the 
missing category, so it is not clear how to calculate contribution. However, in 
most cases, the missing data point corresponds to the value 0, and removing all 
the other data points is very confusing. In older charts (ex. line chart), 
contribution assumes 0 if data is missing, so we should provide some way to 
interpolate 0 for feature parity.
   
   I think there are two ways 
   * Assume 0 whenever data is missing (similar to legacy line chart)
   * Have users use `resample` to fill missing values with 0. This is not 
possible yet because resample doesn't work if there's a group by - the error 
message is: `cannot reindex from a duplicate axis` and occurs 
[here](https://github.com/apache/superset/blob/fd8461406d62e818c4bc88075ac25ddf44ba9caf/superset/utils/pandas_postprocessing.py#L981)
   
   #### How to reproduce the bug
   
   1. Go to SQL Lab
   2. Run query:
   ```sql
   SELECT DATE('2021-09-01') AS ds, 'a' AS x
   UNION ALL SELECT DATE('2021-09-02') AS ds, 'a' AS x
   UNION ALL SELECT DATE('2021-09-01') AS ds, 'c' AS x
   ```
   3. -> explore chart
   4. Use time series bar chart v2 viz
   5. Group by `x`, metric `count`, contribution `total`
   6. Note the missing data point for (`2021-09-02`, `a`)
   
   ### Expected results
   
   Two bars should be shown for 09-01, one bar should be shown for 09-02
   
   ### Actual results
   
   No bars are shown for 09-02, even though there is a data point
   
   
![image](https://user-images.githubusercontent.com/14146019/136434143-10bdd24f-82d7-405b-ae5c-25649928c7a0.png)
   
   ### Environment
   
   (please complete the following information):
   
   - browser type and version: chrome
   - superset version: up to date with master as of 2021-10-01
   - python version: 3.8
   
   ### Checklist
   
   Make sure to follow these steps before submitting your issue - thank you!
   
   - [X] I have checked the superset logs for python stacktraces and included 
it here as text if there are any.
   - [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.
   
   ### Additional context
   
   This is somewhat related to this issue: 
https://github.com/apache/superset/issues/15036
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to