1
votes

I have written two queries below to extract distinct count/record from a table. However, both of them are giving me different results.

The first query returns more records than the second query.

query 1:

.ReachOptimization_L0
| where CurrentSubscriptionStatus == "ACTIVE"| where SnapshotDate =="2019-11-29"| where IsOptIn==1| where CampaignName != ""  or CampaignId != ""| where ReachedFlag== 1| summarize dcount(UserPUID)

query 2:

.ReachOptimization_L0| where CurrentSubscriptionStatus == "ACTIVE"| where SnapshotDate =="2019-11-29"| where IsOptIn==1| where CampaignName != ""  or CampaignId != ""| where ReachedFlag== 1| distinct UserPUID
1

1 Answers

2
votes

dcount() aggregation function is an estimation of distinct count as outlined in https://docs.microsoft.com/en-us/azure/kusto/query/dcount-aggfunction

"Returns an estimate for the number of distinct values taken by a scalar expression in the summary group."

The estimation accuracy can be found on the same page: https://docs.microsoft.com/en-us/azure/kusto/query/dcount-aggfunction#estimation-accuracy