You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2022/09/13 10:55:39 UTC

[GitHub] [superset] derichev-ozon opened a new issue, #21455: PivotTable doesn't corrently count total (SUM) in case of division metric

derichev-ozon opened a new issue, #21455:
URL: https://github.com/apache/superset/issues/21455

   Currelty Superset (v.1.5.1 and also in v.2.0.0) for Chart PivotTable (v1 and v2) doesn't corrently count total/subtotal (SUM aggregation) in case of division metric exists. 
   For example: 
   Let's create PivotTable, add metrics and populate as following
   ![image](https://user-images.githubusercontent.com/108678913/189879365-b500eb25-6d58-4f84-a2e0-afeff699bf1d.png)
   Where is "proc" column is metric with function "SUM(fm) / SUM(gmv)" . As you can see Total (Sum) is **2.7** , but it should be 165M / 376M ~= **0.4388** .  So Superset just SUM column "proc" values instead of direct division.    
   
   #### How to reproduce the bug
   
   1. Create dataset "default.test_pivot", for instance using following SQL:
   ```
   SELECT 34523.323 as gmv, 24523.323 as fm, '1' as shem, '1' as gr
   UNION all
   SELECT 325323543.323 as gmv, 125323543.323 as fm, '2' as shem, '1' as gr
   UNION all
   SELECT 5764545.323 as gmv, 4764545.323 as fm, '3' as shem, '2' as gr
   UNION all
   SELECT 45254525.323 as gmv, 35254525.323 as fm, '4' as shem, '2' as gr
   ```
   
   2. Create Chart PivotTable v2 (visualization type = Pivot Table v2) based on dataset above. 
   3. Populate rows  as "gr" (Simple ABC gr) and "shem" (Simple ABC shem)  
   4. Create metrics: 
      - SUM(gmv) (Simple , Column = gmv, aggregate = SUM) 
      - SUM(fm)  (Simple , Column = fm, aggregate = SUM) 
      - proc (Custom SQL with value SUM(fm) / SUM(gmv) )
   5. In the Options area check "Show columns total" and select Aggregation functiona as "SUM" 
   6. Run (evaluate values for Chart)
   
   
   ### Expected results
   
   Total (Sum) should be 165M / 376M ~= **0.4388** .  The same for Subtotal correspondingly    
   
   ### Actual results
   
   Total (Sum) is **2.7** ,  just SUM column "proc" values instead of direct division.    
   
   #### Screenshots
   
   See above.
   
   ### Environment
   
   - browser type and version: chrome 105.0.5195.102 (64bit version)
   - superset version: 1.5.1
   - python version: 3.8.12
   - node.js version: any
   - any feature flags active: any 
   
   ### Checklist
   Checked:
   - [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
   If some workaround exists it will be also good.
   


-- 
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: notifications-unsubscribe@superset.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] kgabryje commented on issue #21455: PivotTable doesn't corrently count total (SUM) in case of division metric

Posted by GitBox <gi...@apache.org>.
kgabryje commented on issue #21455:
URL: https://github.com/apache/superset/issues/21455#issuecomment-1287204150

   Hey @derichev-ozon! Like @mayurnewase said, it's working as intended - we're showing a sum in total and subtotals regardless of SQL behind given column.
   I can totally see a value in what you're expecting. I think we should treat it as a new feature request - overriding global aggregation function for specific column.


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] PivotTable doesn't corrently count total (SUM) in case of division metric [superset]

Posted by "xakbin (via GitHub)" <gi...@apache.org>.
xakbin commented on issue #21455:
URL: https://github.com/apache/superset/issues/21455#issuecomment-1774138277

   Please tell me the status, this problem is very annoying


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] mayurnewase commented on issue #21455: PivotTable doesn't corrently count total (SUM) in case of division metric

Posted by GitBox <gi...@apache.org>.
mayurnewase commented on issue #21455:
URL: https://github.com/apache/superset/issues/21455#issuecomment-1249885660

   ahh sorry missed it.


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] PivotTable doesn't corrently count total (SUM) in case of division metric [superset]

Posted by "geido (via GitHub)" <gi...@apache.org>.
geido commented on issue #21455:
URL: https://github.com/apache/superset/issues/21455#issuecomment-1961775452

   Closing this as we are not supporting versions older than 3.X at the moment. Feel free to open a new issue if you feel this is still a problem with recent versions of Superset. Thank you!


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] mayurnewase commented on issue #21455: PivotTable doesn't corrently count total (SUM) in case of division metric

Posted by GitBox <gi...@apache.org>.
mayurnewase commented on issue #21455:
URL: https://github.com/apache/superset/issues/21455#issuecomment-1249948113

   I think this is correct behaviour to show sum of column instead of checking how its calculated, I might be wrong.


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] derichev-ozon commented on issue #21455: PivotTable doesn't corrently count total (SUM) in case of division metric

Posted by GitBox <gi...@apache.org>.
derichev-ozon commented on issue #21455:
URL: https://github.com/apache/superset/issues/21455#issuecomment-1246382689

   @mayurnewase Thanks for response! Actually I use exactly pivottable 2 (if you meant v2):
   
   > 2. Create Chart PivotTable v2 (visualization type = Pivot Table v2) based on dataset above.


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] PivotTable doesn't corrently count total (SUM) in case of division metric [superset]

Posted by "geido (via GitHub)" <gi...@apache.org>.
geido closed issue #21455: PivotTable doesn't corrently count total (SUM) in case of division metric 
URL: https://github.com/apache/superset/issues/21455


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] mayurnewase commented on issue #21455: PivotTable doesn't corrently count total (SUM) in case of division metric

Posted by GitBox <gi...@apache.org>.
mayurnewase commented on issue #21455:
URL: https://github.com/apache/superset/issues/21455#issuecomment-1246296203

   use pivottable 2, this one is deprecated and has few bugs which are less likely to be fixed in the future.


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org