Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/wix/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Mdx Olap多维数据集计算成员,如何取整_Mdx_Olap_Cube_Olap Cube - Fatal编程技术网

Mdx Olap多维数据集计算成员,如何取整

Mdx Olap多维数据集计算成员,如何取整,mdx,olap,cube,olap-cube,Mdx,Olap,Cube,Olap Cube,我创建了一个计算成员,其值为: [Measures].[Value] / [Measures].[Recuento Fact Result] 我想对这个值进行四舍五入,只保留前两位小数, 例如: [Measures].[Value]=10 [Measures].[Recuento Fact Result]=3 我的计算会员=3.3333 我想要3.33分 我该怎么做?试试这个: Round( [Measures].[Value]/[Measures].[Recuento Fact Res

我创建了一个计算成员,其值为:

[Measures].[Value]
/
[Measures].[Recuento Fact Result]
我想对这个值进行四舍五入,只保留前两位小数, 例如:

[Measures].[Value]=10
[Measures].[Recuento Fact Result]=3
我的计算会员=3.3333

我想要3.33分

我该怎么做?

试试这个:

Round(
  [Measures].[Value]/[Measures].[Recuento Fact Result]
  , 2  //<<you can adjust to the number of dec places required
)
您将只返回答案的整数部分

顺便说一句,你应该用像你这样的方法来防范被零除的可能性:

Round(
  IIF(
    [Measures].[Recuento Fact Result] = 0,
    ,null
    ,[Measures].[Value]/[Measures].[Recuento Fact Result]  
  )  
,2
)
Round(
  IIF(
    [Measures].[Recuento Fact Result] = 0,
    ,null
    ,[Measures].[Value]/[Measures].[Recuento Fact Result]  
  )  
,2
)