计算 U-SQL 百分比
Calculate U-SQL Percentage
我正在尝试计算部署百分比。但是我的 CASE 语句返回一个整数。
示例:
部署 = 133
许可 = 930
利用率应该 == 14%
然而,returns 0
这里是 table 使用模式:
,[Deployment (%)] float?
这是我计算利用率的方法:
(summary.[Deployments] == 0 OR summary.[Licensing] == 0) ? 0 :
(summary.[Deployments] / summary.[[Licensing]) AS [Deployment (%)]
只需要在股息上加上(小数)[=11=]
(summary.[Deployments] == 0 OR summary.[Licensing] == 0) ? 0 :
((decimal)summary.[Deployments] / summary.[[Licensing]) AS [Deployment (%)]
我正在尝试计算部署百分比。但是我的 CASE 语句返回一个整数。
示例: 部署 = 133 许可 = 930
利用率应该 == 14%
然而,returns 0
这里是 table 使用模式:
,[Deployment (%)] float?
这是我计算利用率的方法:
(summary.[Deployments] == 0 OR summary.[Licensing] == 0) ? 0 :
(summary.[Deployments] / summary.[[Licensing]) AS [Deployment (%)]
只需要在股息上加上(小数)[=11=]
(summary.[Deployments] == 0 OR summary.[Licensing] == 0) ? 0 :
((decimal)summary.[Deployments] / summary.[[Licensing]) AS [Deployment (%)]