30
votes

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

1
Are you using Application Insights Analytics? If so, try datepartPeter Bons

1 Answers

77
votes

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)