You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Kusto/KQL查询结果数字格式化:添加千分位逗号并取整

KQL实现数值千分位格式化并取整的方案

KQL没有直接对应format_number(myNumberColumn, 0, "commaThousands")的参数化调用,但可以通过内置函数组合实现需求:

  • 直接使用format_number()函数,指定格式字符串'N0',即可同时完成四舍五入到整数和添加千分位逗号的效果,输出为字符串类型。
  • 示例代码:
// 模拟测试数据
datatable(rawValue:double)
[
    1000.2865,
    12345.6789,
    987.123,
    0.5,
    -1234.9
]
| project rawValue, formattedValue = format_number(rawValue, 'N0')
  • 输出结果:

    rawValueformattedValue
    1000.28651,000
    12345.678912,346
    987.123987
    0.51
    -1234.9-1,235
  • 补充说明:如果需要显式先执行四舍五入操作,也可以先调用round()函数再格式化,效果完全一致:

formattedValue = format_number(round(rawValue), 'N0')

内容的提问来源于stack exchange,提问作者SendETHToThisAddress

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.20 06:45:36