File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed
apps/api/src/query/builders Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -179,6 +179,13 @@ export const DevicesBuilders: Record<string, SimpleQueryConfig> = {
179179 label : 'Visitors' ,
180180 description : 'Unique visitors with this connection type' ,
181181 } ,
182+ {
183+ name : 'percentage' ,
184+ type : 'number' ,
185+ label : 'Usage %' ,
186+ description : 'Percentage of total connection type usage' ,
187+ unit : '%' ,
188+ } ,
182189 ] ,
183190 default_visualization : 'table' ,
184191 supports_granularity : [ 'hour' , 'day' ] ,
@@ -189,6 +196,7 @@ export const DevicesBuilders: Record<string, SimpleQueryConfig> = {
189196 'connection_type as name' ,
190197 'COUNT(*) as pageviews' ,
191198 'COUNT(DISTINCT anonymous_id) as visitors' ,
199+ 'ROUND((COUNT(*) / SUM(COUNT(*)) OVER()) * 100, 2) as percentage' ,
192200 ] ,
193201 where : [ "connection_type != ''" , "event_name = 'screen_view'" ] ,
194202 groupBy : [ 'connection_type' ] ,
You can’t perform that action at this time.
0 commit comments