我正在尝试区分维度区域的数量。但是我认为我得到的与(日期,地区)计数不同。 这是查询:
{
"queryType": "groupBy",
"dataSource": "model",
"granularity": "all",
"filter": {
"type": "selector", "dimension": "District", "value": "ATLANTA"},
"aggregations":[
{"name":"!t5", "type":"distinctCount","fieldName":"Territory"},
{"name":"!T_4","type":"longSum","fieldName":"Units"}
],
"postAggregations":[
{
"type":"arithmetic",
"fn":"*",
"fields":[
{
"type":"arithmetic",
"fn":"/",
"fields":[
{
"type":"fieldAccess",
"fieldName":"!T_4"
},
{
"type":"fieldAccess",
"fieldName":"!t5"
}
]
},
{
"type":"constant",
"value":1
}
],
"name":"AverageDistrict"
}
],
"intervals": ["2018-06-13T00:00Z/2018-07-25T00:00Z"]
}
因此,当我更改日期范围时,distinct(!t5)的计数也会增加。而在原始数据中,在所有日期范围内,不重复计数始终是恒定的。 我需要的是该日期范围内不同区域值的计数。我希望我已经说清楚了。
答案 0 :(得分:2)
尝试使用“基数”聚合器代替“ distinctCount”聚合器。希望这会有所帮助。