diff --git a/values/umami/queries/weekly-sim-submit-count-norm.sql b/values/umami/queries/weekly-sim-submit-count-norm.sql new file mode 100644 index 00000000..f19f8bc6 --- /dev/null +++ b/values/umami/queries/weekly-sim-submit-count-norm.sql @@ -0,0 +1,24 @@ +-- Pivots the sim count to use the sim kinds as columns. This is what is called +-- in grafana. If we get more sim kinds, they must be added here, and also in grafana. +-- +-- group_name | transport | lice | virus | watercontact | sedimentation +-- --------------+-----------+------+-------+--------------+--------------- +-- @mowi.com | 1 | | | | +-- @oceanbox.io | 1 | 1 | 5 | 6 | +-- @scaleaq.com | 7 | | | | +-- (3 rows) + +SELECT + * +FROM + crosstab_weekly_sim_submit_count( + 'SELECT * FROM weekly_sim_submit_count + WHERE sim_type IN ( + ''transport'', + ''lice'', + ''virus'', + ''watercontact'', + ''sedimentation'' + ) + ORDER BY 1, 2' + )