5 Replies Latest reply: Feb 21, 2014 7:03 AM by Miroslav Pešák RSS

    Count state from last occurence

      Hello Community :-)

      I need to count projects depending on theirs states, but problem is, that state of projects is changing over time and I want to count always last occurence. I tried this, but it doesn't work for me: count(aggr(max(rep_date),project_id))

      Data look like that:


      project_id, date, state

      111, 1.1.2014, A

      111, 5.1.2014, B

      222, 2.1.2014, C

      222, 3.2.2014, B

      333, 3.1.2014, C


      And result I want is:


      B = 2

      C = 1

      (state A from project 111 and state C from project 222 are not last occurence...)


      Could you help me please?

      Thank you ;-)