3 Replies Latest reply: Dec 29, 2014 10:12 AM by jonathan morgan RSS

    sum function not working on nested if statements

      hello all,

      i have a nested if statement that works properly. i need to sum the result so that i can get the sum to show when i swich to pivot table view.

       

       

       

      if

       

      ((AddMonths((date(today())),-v_mlai)>date(max({$<m=,q=,y=,day=>}[sale date])))
      ,sum({$<m=,q=,y=,day=>}[[items in inventory])

      ,if(IsNull([sale date])
      ,if((AddMonths((date(today())),-v_mlai)>date(Max({$<m=,q=,y=,day=>}[inventory date])))
      ,sum({$<m=,q=,y=,day=>}[items in inventory])
      ,0)
      ,0)
      )

      i have tried puting the entire statement in a sum() function but that dosnt work (i get ' -'  value in all the cells). i also tried reconstracting the statement in severl different ways removing the set analysis and removing the sum() statements that are in the if() statments but i cant get it to wrok.

       

      can someone pls tell me why dosnt puting the entire statement in a sum() function work?

      also if you have any sugastions on how to reconstract the statment so that i get to sum to show on a pivot table, they will be greatly appreciated.

       

      thanks in advance,

      jonathan