Quantcast
Channel: SQL Server Analysis Services forum
Viewing all articles
Browse latest Browse all 14337

MDX Using iif function to supress 1.#INF error not working

$
0
0

 Hi All

I am trying to do a calculation using 2 calculated members, one of the values can = 0 which when dividing creates the1.#INF, i have attempted to use an iif function to work around it but it doesnt seem to be working. can anyone say why its not working or what i can do to fix it?

the code and result set are bleow

with member Measures.Total as
sum (
PERIODSTODATE( [Date 1].[Hierarchy].[Year Month Desc] ,
[Date 1].[Hierarchy].currentmember
) * [Date 1].[Workdays Past In Month].DefaultMember *  [Date 1].[Workdays Left In Month].DefaultMember,
 [Measures].[New Start])
 member measures.DaysPast as   [Date 1].[Workdays Past In Month].member_Caption
 MEMBER [Measures].[NullValue] AS Null
 member measures.TestAvgStart as iif(  [measures].[DaysPast]  = 0 ,[Measures].[NullValue] , (Measures.Total/measures.DaysPast)), FORMAT_STRING = "#,#0"
--------------------------------------------------------------------------------
select {[Measures].[New Start],Measures.Total,measures.DaysPast,measures.TestAvgStart }    on 0 ,
(
 [Date 1].[Hierarchy].[Full Date]
,[Date 1].[Workdays Past In Month].children
,[Date 1].[Workdays Left In Month].children
) 
on 1
from sales
where [Date 1].[Previous Month].[1]

DateDays PastDays left New StartTotalDaysPastTestAvgStart
01/06/201302069690         1.#INF
02/06/20130204730          1.#INF
03/06/20131191241971197
04/06/20132181413382169
05/06/20133171244623154
06/06/20134161586204155




Viewing all articles
Browse latest Browse all 14337

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>