Question

I have a calculated column that basicly calculates an average time on page.

fix([Measures].[Time on Page] / ([Measures].[Pageviews] -[Measures].[Exits])) /3600)

the problem is that if Measures].[Time on Page] is 0 its messing up the Calculation due to a devide by 0 error. Is there a way to test for this, maybe add an If statment into the Calcualtion?

Était-ce utile?

La solution

If you are using 2012 version, you can use the new divide function. Here is a link describing how to use that. http://cwebbbi.wordpress.com/2013/07/26/new-mdx-divide-function/ Basically, Divide (, [,])

Alternatively you can use an IF statement to check if the divisior is 0.

But there are cases where we have near 0 numbers as well. For example if you have adjustment data to correct the actuals, you may end up actual value 5, and adjustment value -5 and as a result you expect 0. That may not happen in all the cases. Because of how numbers aggregated internally etc. So the number could become 0.00000001 instead of 0. For such cases, you need to adjust your condition.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top