5 Replies Latest reply: Aug 5, 2017 3:30 PM by Pankaj Thakur RSS

    Set analysis or if with measures.

    Simone Trabattoni

      Hi community,

      I'm working on an app that makes me problem. The goal is to have a kpi that counts the worker that have sold "type a" things, and their sales of last year are stricly lower than sales of this year.

       

      The data are those:

       

      Load*Inline

      [worker,workerid

      a,1

      b,2

      c,3

      d,4

      ];

       

       

      Load*Inline

      [workerid,sale,type,year

      1,5,a,2016

      1,4,a,2017

      2,1,a,2016

      2,8,a,2017

      3,9,a,2016

      3,2,a,2017

      3,1,a,2017

      4,4,a,2017

      ];

       

       

      Putting on a table, with the if clause it is all fine, but in a KPI, it does not work and I do not know why.

      The formulae of the kpi are

       

      if

      if( sum({$<type={"a"},year={"2016"}>}sale) > sum({$<type={"a"},year={"2017"}>}sale) ,count(workerid),0 )

       

      set

      count({$<type={"a"},year={"2016"},workerid={"$(sum({$<type={"a"},year={"2016"}>}sale) > sum({$<type={"a"},year={"2017"}>}sale))"}>}workerid)

       

      kpi.PNG

      I've attached the app.

      Thanks a lot.