Window Google 工作表查询函数中的函数
Window Functions in Google Sheets' Query Function
google张查询函数中有window个函数吗?
动机:
我目前正在根据这个公式构建数据库
=QUERY('DB'!A2:J,"select C, E, F, sum (J), count(J) where G = 'Gross Enterprise Subscription' group by C, E, F order by SUM(J) desc label C 'Owner', E 'Country', F 'Region', sum(J) 'Delta ES Increase', count(J) 'Num Enterprises in portfolio'",1)
但我希望我可以在计数 (J) 中添加类似“countifs”的函数端,我会在其中放置一个子句“where J > 0”,这样我就可以同时拥有 'Num Enterprises in portfolio',这是计数(j) 和 'Num Enterprises in portfolio > 0' 即 count(j > 0).
尝试:
=ARRAYFORMULA(QUERY({'DB'!A2:J, IF('DB'!J2:J > 0, 1, )},
"select Col3,Col5,Col6,sum(Col10),count(Col10),count(Col11)
where Col7 = 'Gross Enterprise Subscription'
group by Col3,Col5,Col6
order by sum(Col10) desc
label Col3'Owner',
Col5'Country',
Col6'Region',
sum(Col10)'Delta ES Increase',
count(Col10)'Num Enterprises in portfolio',
count(Col11)'Num Enterprises in portfolio > 0'", 1))
google张查询函数中有window个函数吗?
动机:
我目前正在根据这个公式构建数据库
=QUERY('DB'!A2:J,"select C, E, F, sum (J), count(J) where G = 'Gross Enterprise Subscription' group by C, E, F order by SUM(J) desc label C 'Owner', E 'Country', F 'Region', sum(J) 'Delta ES Increase', count(J) 'Num Enterprises in portfolio'",1)
但我希望我可以在计数 (J) 中添加类似“countifs”的函数端,我会在其中放置一个子句“where J > 0”,这样我就可以同时拥有 'Num Enterprises in portfolio',这是计数(j) 和 'Num Enterprises in portfolio > 0' 即 count(j > 0).
尝试:
=ARRAYFORMULA(QUERY({'DB'!A2:J, IF('DB'!J2:J > 0, 1, )},
"select Col3,Col5,Col6,sum(Col10),count(Col10),count(Col11)
where Col7 = 'Gross Enterprise Subscription'
group by Col3,Col5,Col6
order by sum(Col10) desc
label Col3'Owner',
Col5'Country',
Col6'Region',
sum(Col10)'Delta ES Increase',
count(Col10)'Num Enterprises in portfolio',
count(Col11)'Num Enterprises in portfolio > 0'", 1))