35

How can I summarize records by year, month,day and hour only?

1

1 Answer 1

91

In Application Insights Analytics:

By hour:

requests 
 | summarize count() by bin(timestamp, 1h) 

By day:

requests 
 | summarize count() by bin(timestamp, 1d) 

By month

requests 
  | summarize count()  by bin(datepart("Month", timestamp), 1) 

By year

requests 
  | summarize count()  by bin(datepart("Year", timestamp), 1) 
1
  • 10
    Just wanted to mention that there are also aliases for this: startofday(timestamp), startofweek, startofmonth and startofyear. it should be a bit easier to use. Jun 7, 2017 at 9:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.