1

我最近一直在使用 GOOD-DATA 平台。我在 MAQL 方面没有太多经验,但我正在努力。我在 GOOD-DATA 平台上做了一些指标和报告。最近我尝试创建一个指标来计算总买家、首次购买者和重复购买者。我创建了这三个报告并且工作完美。但是当我尝试添加订单日期父过滤器时,第一次买家和重复买家的价值出错了。请查看以下查询。

我可以使用 sql 查询找出正确的值。

MAQL 查询:

TOTAL ORDERS- SELECT COUNT(NexternalOrderNo) BY CustomerNo WITHOUT PF TOTAL FIRSTTIMEBUYERS- SELECT COUNT(CustomerNo) WHERE (TOTAL ORDER WO PF=1) WITHOUT PF Total REPEATINGBUYERS- SELECT COUNT(CustomerNo) WHERE (TOTAL ORDER WO PF>1) without PF

任何人都可以建议使用 MAQL 查找这些值的逻辑吗

4

2 回答 2

1

目前还不清楚你想做什么。如果您可以提供有关您需要获取的报告的更多详细信息,那就太好了。

没有必要将“没有 pf”放入指标中。该子句禁止过滤器应用,因此当您删除它时,将在那里使用父过滤器。你可能会得到你想要的。具体来说,修改这个:

SELECT COUNT(CustomerNo) WHERE (TOTAL ORDER WO PF>1) WITHOUT PF

至:

SELECT COUNT(CustomerNo) WHERE (TOTAL ORDER WO PF>1)
于 2014-02-13T14:47:59.247 回答
1

The only thing you miss here is "ALL IN ALL OTHER DIMENSIONS" aka "ALL OTHER". This keyword locks and overrides all attributes in all other dimensions—keeping them from having any affect on the metric. You can read about it more in MAQL Reference Guide.

FIRSTTIMEBUYERS:

SELECT COUNT(CustomerNo) 
WHERE (SELECT IFNULL(COUNT(NexternalOrderNo), 0) BY Customer ID, ALL OTHER) = 1 

REPEATINGBUYERS:

SELECT COUNT(CustomerNo) 
WHERE (SELECT IFNULL(COUNT(NexternalOrderNo), 0) BY Customer ID, ALL OTHER) > 1 
于 2014-02-14T08:16:51.560 回答