Reputation: 41
I created a calculated member and his value is:
[Measures].[Value]
/
[Measures].[Recuento Fact Result]
I want to round that value, and save only the first two decimals, for example:
[Measures].[Value]=10
[Measures].[Recuento Fact Result]=3
My calculated member = 3.3333333333333333333
I want to get 3.33
How can I do this?
Upvotes: 2
Views: 1290
Reputation: 35557
Try this:
Round(
[Measures].[Value]/[Measures].[Recuento Fact Result]
, 2 //<<you can adjust to the number of dec places required
)
Another interesting rounding function that is used in mdx
is Fix
Fix(
[Measures].[Value]/[Measures].[Recuento Fact Result]
)
You'll only get the integer part of the answer returned.
As an aside - you should defend against divide by zero possibilities with a measure like yours like this:
Round(
IIF(
[Measures].[Recuento Fact Result] = 0,
,null
,[Measures].[Value]/[Measures].[Recuento Fact Result]
)
,2
)
Upvotes: 1