GitHub user swheeler7 added a comment to the discussion: Pivot Table V2
Improvements
For anyone coming to this I was able to achieve what I needed using custom
metrics and jinja templating. I have created the following custom metrics on my
dataset:
Total Percent: COUNT(*) / SUM(COUNT(*)) OVER ()
Row Percent: COUNT(*) / SUM(COUNT(*)) OVER (PARTITION BY {{ columns[1] if
columns else '1' }})
Column Percent: COUNT(*) / SUM(COUNT(*)) OVER (PARTITION BY {{ columns[0] if
columns else '1' }})
Now the only issue is that the pivot table formatting is applied to all metrics
but that can be solved by casting the custom metrics to text and adding '%'
symbols or whatever custom formatting is needed.
I still will leave this discussion open as it will greatly improve the
ergonomics of the pivot table, and also there may be performance gains to be
had from calculating the percentages client side vs calculating 3 custom
metrics on each table
GitHub link:
https://github.com/apache/superset/discussions/38036#discussioncomment-15840450
----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]