1
votes

I want to know the total number of Users in the last 7 days, but the result shown in Azure Portal and in the App Insights Analytics app are different:

Azure Portal:

enter image description here

Analytics:

enter image description here

The Analytics query is the one generated automatically from Azure, I just added the sum to show the difference. I waited a couple of days to discard a sync issue or something. Am I missing something?

1

1 Answers

1
votes

The right query to get distinct users over 7 days in Analytics would be:

union pageViews, customEvents | where timestamp > ago(7d) | summarize Users = dcount(user_Id)

If sum(Users) is used after dcount was applied then it may count the same user twice if that user visited on several days.

So, essentially you may need two Analytics queries - one to display daily chart of the users, another to display overall count. You may achieve this in one query with hll() that executes partial distinct count that can be merged later.