2 Replies Latest reply: Oct 7, 2016 1:03 AM by Jonathan Dienst RSS

    Expression in load script

    Kshitija Shinde

      Hello Everyone,

       

      How will i use the folllowing formula in load script?

       

      networkdays(Avg({<StatusName={'On pilot'}>}CreatedDate),Avg({<StatusName={'Pilot Ok'}>}ceateddate))

       

       

      Thanks in advance

        • Re: Expression in load script
          Rohit Kumar

          Hi Kshitija,

           

          Aggregate functions doesn't work in script editor . Please try to use it in calculated measure.

           

          Please mark the appropriate replies as CORRECT / HELPFUL so our team and other members know that your question(s) has been answered to your satisfaction.

           

           

          Rohit Kumar

          • Re: Expression in load script
            Jonathan Dienst

            I assume the CreatedDate is the correct name for 'createddate;. Remember that QV field names are case sensitive.

             

            In s standalone load:

            LOAD NetWorkDays(Avg(If(StatusName = 'On pilot', CreatedDate)) Avg(If(StatusName = 'Pilot Ok', CreatedDate))) as WorkDays

            FROM ...

             

            If you are also loading other fields, then non-aggregated fields will need to be in a Group By clause:

             

            LOAD NetWorkDays(Avg(If(StatusName = 'On pilot', CreatedDate)) Avg(If(StatusName = 'Pilot Ok', CreatedDate))) as WorkDays,

              Division,

              Period,

              ...

            FROM ...

            Group By Division,

              Period,

              ...