1 Reply Latest reply: Aug 11, 2011 9:30 AM by Alexandre DAUCHY RSS

    Snapshot of dates...

      Hello all,

      I have a table with 5 columns:


      Ticket ID, Ticket Status, From Date, To Date, %DateKey

      111, New, 20110701, 20110808, 20110701|20110808

      111, Solved, 20110809,20110901, 20110809|20110901


      The %DateKey is connected to a calendar  where there is one row per day, within the date range, for each %DateKey.


      This works fine. But when I do a count(Ticket ID) per Month the result could contain the same Ticket ID several times if it has several statuses within a month (like the example above). What I am looking for is the last status for the month, that is, I would like to have a snapshot of the state of all tickets the last day each month. That means, looking att the rows above, the Ticket with ID 111 is only counted once in August with status solved because that is the status on the last day.


      If I use count(DISTINCT Ticket ID) what ticket ID is it that is considered in the calculation?


      Any suggestions how to solve this?