3 Replies Latest reply: Nov 10, 2016 4:27 PM by John Witherspoon RSS

    Selecting default maximum period

    m ellis

       

      The following code which works perfectly fine combined with a PIT master calendar: 

       

      =Sum({<TargetPeriod={"$(=(SalePeriod))"}, Salesman=, SaleFiscalYear=, SaleFiscalYear=, [TargetGroup] =, SaleWeekDay=,SaleQuarter=, SaleMonth= >} Target)

      i.e. if a date is selected then it sums up the Target for  the target period (multiple salespeople  have targets within the same TargetPeriod).

       

      However what I  would like to do is default to the latest target/sales period, if no date selections have been made with an if statement. I was hoping it would be a simple case of:

       

      IF (getselectedcount(SaleYear) 1,

      Sum({<TargetPeriod={"$(=(SalePeriod))"}, Salesman=, SaleFiscalYear=, SaleFiscalYear=, [TargetGroup] =, SaleWeekDay=,SaleQuarter=, SaleMonth= >} Target),

        Sum({<TargetPeriod={"$(=Max(SalePeriod))"}, Salesman=, SaleFiscalYear=, SaleFiscalYear=, [TargetGroup] =, SaleWeekDay=,SaleQuarter=, SaleMonth= >} Target))

       

      But no joy I get 0 when using the second statement in isolation with the max function. I notice SalePeriod on it’s own fine. But  Max(SalePeriod)  returns nothing.

      Any help much appreciated thanks.