【发布时间】:2020-08-05 10:25:03
【问题描述】:
示例表:
Date, CustomerID
2020-01-01,a
2020-01-01,b
2020-01-01,c
2020-01-02,a
[...]
2020-01-31,a
2020-01-31,b
2020-01-31,c
2020-01-31,d
2020-02-01,a
2020-02-01,b
[...]
假设我将日期范围设置为 2020-01-01 - 2020-01-31。
我想计算两者之间的差异:
(count_distinct(CustomerId) with filter Date=2020-01-01) - (count_distinct(CustomerId) with filter Date=2020-01-31) and get the result 1.
我尝试过MAX(Date) 和MIN(Date),但是我找不到将其用作过滤器的方法。
当连接到大查询时,我可以使用@DS_START_DATE,但我想在数据工作室中使用它。
这可能吗?谢谢你。
【问题讨论】: