Paiwand Karem
08/03/2024, 7:04 AMMichal Hauzírek
08/04/2024, 2:46 PMHAVING TOP(20) IN (metric) condition.
The trick is to use HAVING instead of WHERE, this causes the filter to be applied after the inner metric is calculated and therefore it won’t affect the percentages and their base.
So something like this should work:
SELECT
SUM({fact/devices_seen}) / (SELECT SUM({fact/devices_seen}) BY ALL OTHER)
HAVING TOP(20) IN (SELECT SUM({fact/devices_seen}))Michal Hauzírek
08/04/2024, 2:52 PMPaiwand Karem
08/05/2024, 3:17 AM