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/02/21 16:31:37 UTC

[GitHub] [superset] jacobcroope opened a new issue #18836: Charts: Custom Calculated Percentage Metrics not behaving as expected in Tables Chart

jacobcroope opened a new issue #18836:
URL: https://github.com/apache/superset/issues/18836


   We are interested in calculating a fair share metric which requires dividing two percentages within a table. The percentage metrics correctly calculate a % of what is displayed in a table dynamically with filters which is critical to our application. Here is a screenshot of the type of visualization I am trying to make. I would expect the value to be an index around 1. For Wii Sports with 20.38% of North American Market and 22.39% of Global Market the value should be 91%
   
   ![image](https://user-images.githubusercontent.com/1770898/154991299-0c189ced-9c83-4f38-9bc1-5306bb1b4072.png)
   
   The SQL statement is dividing them before calculating percentages.
   ![image](https://user-images.githubusercontent.com/1770898/154992363-3875c941-da87-41f9-a621-38c7de62732d.png)
   
   In PowerBi, Tableu, and Excel there is a way to accomplish this. Is there a way to do this in Superset I am unaware of or is this something that needs to be added to the visualization?
   
   Other operations don't provide the expected results either. 
   ![image](https://user-images.githubusercontent.com/1770898/154993162-606a1567-cd41-4470-be64-4d35628d85f7.png)
   
   ### Environment
   Superset - Current as of today. 
   ### 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.
   


-- 
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] villebro commented on issue #18836: Charts: Custom Calculated Percentage Metrics not behaving as expected in Tables Chart

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


   If you want to calculate the proportion of one aggregate over another one, I believe you should use `SUM` rather than `AVG`? In other words, to calculate the total amount of sales in Nort America as a proportion of global sales, I would do `SUM(na_sales)/SUM(global_sales)`, not `AVG(na_sales)/AVG(global_sales)`:
   
   ![image](https://user-images.githubusercontent.com/33317356/155108302-c089db14-27ad-4452-8061-18714e1fde4f.png)
   
   Or am I misunderstanding something?


-- 
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] villebro commented on issue #18836: Charts: Custom Calculated Percentage Metrics not behaving as expected in Tables Chart

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


   Converting to discussion


-- 
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