从其他 2 个表创建百分比 Table - Google 查询

Create Percentage Table from 2 other tables - Google Query

有没有办法计算第 3 个交叉表 Table,其中包含从 Google 查询创建的 2 个交叉表 table 的百分比?最初我使用大括号将 2 个查询堆叠在一起,但发现如果行或列不匹配,那么 table 查询都会导致 #VALUE 错误。因此将 2 tables 与它们之间的 100 组行分开。我想计算低于这些 table 的 FTR 百分比 table。

这是一个具有编辑权限的FTRTable

可以参考我之前的相关post here.

FTR 的公式 table:

=ARRAYFORMULA(REGEXREPLACE(TO_TEXT(QUERY(QUERY({QUERY(
 {InputData!D3:D&"♦"&InputData!C3:C, InputData!B3:F, InputData!D3:D&
 IF(InputData!D3:D="",,"♥"&TEXT(InputData!D3:D, "dd/mm/yyyy"))}, 
 "select Col1,Col4,Col3,Col7,count(Col2) 
  where Col4 is not null 
    and year(Col4)="&C1&" 
    and Col5 != 'lost'     
  group by Col1,Col4,Col3,Col7"),
IFNA(VLOOKUP(INDEX(QUERY({InputData!D3:D&"♦"&InputData!C3:C, InputData!B3:F}, 
 "select Col1,Col4,Col3,count(Col2) 
  where Col4 is not null 
    and year(Col4)="&C1&" 
    and Col5 != 'lost'     
  group by Col1,Col4,Col3"),,1), 
QUERY({InputData!D3:D&"♦"&InputData!C3:C, InputData!B3:F}, 
 "select Col1,count(Col2) 
  where Col4 is not null 
    and year(Col4)="&C1&" 
    and Col5 != 'lost' 
    and Col6  = 'yes' 
  group by Col1"), 2, 0))}, 
 "select Col4,Col3,Col6/Col5"), 
 "select Col2,max(Col3) 
  group by Col2
  pivot Col1 
  label Col2'FTR%' 
  format max(Col3)'#.00%'")), "(\d+♥)", ))


和一个公式中的所有 3 个 table 完全动态:

=ARRAYFORMULA({TRANSPOSE(QUERY(TRANSPOSE(QUERY(IFNA(
 HLOOKUP(INDEX(TRANSPOSE(QUERY(InputData!A3:F, 
 "select D,count(B) 
  where D is not null 
    and year(D)="&C1&" 
    and E!='lost' 
  group by D 
  pivot C 
  label D 'NO OF ISSUES'")), 1), TRANSPOSE(QUERY({InputData!A3:F}, 
 "select Col4,count(Col2) 
  where Col4 is not null
    and year(Col4)="&C1&" 
    and Col5!='lost' 
    and Col6 = 'yes' 
  group by Col4 
  pivot Col3 
  label Col4 'NO OF ISSUES'")), ROW(A1:A10000), 0)), 
 "where Col1 <> '#REF!'")), 
 "format Col1'm/d/yyyy'")); 
 SPLIT(REPT(" ♠", COLUMNS(TRANSPOSE(QUERY(InputData!A3:F, 
 "select D,count(B) 
  where D is not null
    and year(D)="&C1&" 
    and E!='lost' 
  group by D 
  pivot C 
  label D 'TOTAL OPPORTUNITIES'")))), "♠"); 
 TRANSPOSE(QUERY(InputData!A3:F, 
 "select D,count(B) 
  where D is not null
    and year(D)="&C1&" 
    and E!='lost' 
  group by D 
  pivot C 
  label D 'TOTAL OPPORTUNITIES'")); 
 SPLIT(REPT(" ♠", COLUMNS(TRANSPOSE(QUERY(InputData!A3:F, 
 "select D,count(B) 
  where D is not null
    and year(D)="&C1&" 
    and E!='lost' 
  group by D 
  pivot C 
  label D 'TOTAL OPPORTUNITIES'")))), "♠");
 REGEXREPLACE(TO_TEXT(QUERY(QUERY({QUERY(
 {InputData!D3:D&"♦"&InputData!C3:C, InputData!B3:F, InputData!D3:D&
 IF(InputData!D3:D="",,"♥"&TEXT(InputData!D3:D, "m/d/yyyy"))}, 
 "select Col1,Col4,Col3,Col7,count(Col2) 
  where Col4 is not null 
    and year(Col4)="&C1&" 
    and Col5 != 'lost'     
  group by Col1,Col4,Col3,Col7"),
IFNA(VLOOKUP(INDEX(QUERY({InputData!D3:D&"♦"&InputData!C3:C, InputData!B3:F}, 
 "select Col1,Col4,Col3,count(Col2) 
  where Col4 is not null 
    and year(Col4)="&C1&" 
    and Col5 != 'lost'     
  group by Col1,Col4,Col3"),,1), 
QUERY({InputData!D3:D&"♦"&InputData!C3:C, InputData!B3:F}, 
 "select Col1,count(Col2) 
  where Col4 is not null 
    and year(Col4)="&C1&" 
    and Col5 != 'lost' 
    and Col6  = 'yes' 
  group by Col1"), 2, 0))}, 
 "select Col4,Col3,Col6/Col5"), 
 "select Col2,max(Col3) 
  group by Col2
  pivot Col1 
  label Col2'FTR%' 
  format max(Col3)'#.00%'")), "(\d+♥)", )})

spreadsheet demo