如何创建仅使用 AH 列中最近 7 天内的日期填充数据的查询

How to create a query that only populates data with dates in the AH column that are within the last 7 days

我正在尝试创建一个查询来提取过去 7 天的激活(AH 列 = 激活日期)。我如何构建这个公式?

我尝试猜测下面的公式,但它不起作用

=QUERY(DATA!1:1000, "SELECT A, B, C, D, E, F, G, H, I, J, K, L, M, N, P, AH, AJ WHERE AH > ((Today()-7) AND B <> 'Rep'",1)

下面的公式适用于在 AH 列中提取带有日期(值)的数据,但我只想查看过去 7 天内的日期

=QUERY(DATA!1:1000, "SELECT A, B, C, D, E, F, G, H, I, J, K, L, M, N, P, AH, AJ WHERE AH is not null AND B <> 'Rep'",1)

这样试试:

=QUERY(DATA!1:1000, 
 "select A,B,C,D,E,F,G,H,I,J,K,L,M,N,P,AH,AJ 
  where AH is not null 
  and B <> 'Rep'
  and AH <= date '"&TEXT(TODAY(),   "yyyy-mm-dd")&"'
  and AH >= date '"&TEXT(TODAY()-7, "yyyy-mm-dd")&"'", 1)