6 Replies Latest reply: Jan 27, 2016 11:23 AM by Gysbert Wassenaar RSS

    Help with set analysis

    James Parham

      I want to create a measure that will give me YTD sales if the the previous year's sales are 0.

       

      Here are my expression of PY Sales and YTD Sales:

      PY:

      sum({<[Year]={$(=max(Year)-1)}>} IF(STATUS=31,-1*EXTSHIPAMT,EXTSHIPAMT))

       

      YTD:

      sum({$<[Date]={'<=$(=date(max([Date])))'}, [Year]={$(=max([Year]))}>} if(STATUS=31,EXTSHIPAMT*-1,EXTSHIPAMT))

       

      I tried using an if statement, but it does not work for some reason:

       

      if(sum({<[Year]={$(=max(Year)-1)}>} IF(STATUS=31,-1*EXTSHIPAMT,EXTSHIPAMT))=0, sum({$<[Date]={'<=$(=date(max([Date])))'}, [Year]={$(=max([Year]))}>} if(STATUS=31,EXTSHIPAMT*-1,EXTSHIPAMT)))

       

      Any help is appreciated!

       

      Thanks,

      James