示例表:
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。
Id要计算之间的差:
(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
,但我想在Data Studio中使用它。
这可能吗?谢谢。
也许您可以通过创建三个公式字段来完成此操作?