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]
Date | Days Past | Days left | New Start | Total | DaysPast | TestAvgStart |
01/06/2013 | 0 | 20 | 69 | 69 | 0 | 1.#INF |
02/06/2013 | 0 | 20 | 4 | 73 | 0 | 1.#INF |
03/06/2013 | 1 | 19 | 124 | 197 | 1 | 197 |
04/06/2013 | 2 | 18 | 141 | 338 | 2 | 169 |
05/06/2013 | 3 | 17 | 124 | 462 | 3 | 154 |
06/06/2013 | 4 | 16 | 158 | 620 | 4 | 155 |