将值向下舍入到给定 bin 大小的整数倍。Rounds values down to an integer multiple of a given bin size.

经常与 summarize by ... 结合使用。Used frequently in combination with summarize by .... 如果有一组离散值,它们会分组成较小的特定值集。If you have a scattered set of values, they will be grouped into a smaller set of specific values.

Null 值、null bin 大小或负的 bin 大小将导致 null。Null values, a null bin size, or a negative bin size will result in null.

floor() 函数的别名。Alias to floor() function.




  • value :数字、日期或时间跨度。value : A number, date, or timespan.
  • roundTo :“bin 大小”。roundTo : The "bin size". 可以用来除 value 的数字或时间跨度。A number or timespan that divides value .


最接近以下 valueroundTo 倍数。The nearest multiple of roundTo below value .

(toint((value/roundTo))) * roundTo`


表达式Expression 结果Result
bin(4.5, 1) 4.0
bin(time(16d), 7d) 14d
bin(datetime(1970-05-11 13:45:07), 1d) datetime(1970-05-11)

以下表达式计算持续时间的直方图,其中存储桶大小为 1 秒:The following expression calculates a histogram of durations, with a bucket size of 1 second:

T | summarize Hits=count() by bin(Duration, 1s)