对于特定维度的不同点,我们可以使用基数。但这在时间维度上不可行。 需要计算与时间维度(weekDate)不同的计数。我正在运行以下查询-
{
"queryType":"groupBy",
"dataSource":"data",
"granularity":"ALL",
"aggregations":[
{
"name":"sum_units",
"type":"doubleSum",
"fieldName":"Units"
},
{
"name":"countDiDates",
"type":"cardinality",
"fields":[
"weekDate"
],
"round":true
}
],
"postAggregations":[
{
"type":"arithmetic",
"fn":"/",
"fields":[
{
"type":"fieldAccess",
"fieldName":"sum_units"
},
{
"type":"hyperUniqueCardinality",
"fieldName":"countDiDates"
}
],
"name":"Rate"
}
],
"intervals":[
"2018-01-01T00:00:00.000Z/2030-01-01T00:00:00.000Z"
]
}
我可以想到的另一种解决方法是创建另一个维,该维将是weekDate的副本,然后使用上面的查询来获取不同的计数。我希望这样做而不必更改数据模型