9 Replies Latest reply: Mar 20, 2014 6:22 PM by Nuno Faustino RSS

    Sum based on limited occurences

    Nuno Faustino

      Hi guys,

       

      I should know this but I can't get it to work properly.

       

      I want to sum sales data from today (vToday already calculated) until the 30th occurrence of a working days and only the when working days are equal below. Using the table below, the result should be 4099.

       

      I use a normal calendar tables linked to a sales table. Something like:

       

      DateWorking_daysSales
      17/03/2014(Today)1211
      18/03/2014121
      19/03/2014172
      20/03/20141147
      21/03/20141181
      22/03/2014015
      23/03/201400
      24/03/20141157
      25/03/20141238
      26/03/201400
      27/03/20141100
      28/03/2014142
      29/03/201405
      30/03/20140209
      31/03/20141196
      01/04/2014142
      02/04/20141213
      03/04/20141248
      04/04/201412
      05/04/201404
      06/04/20140243
      07/04/20141216
      08/04/201418
      09/04/20141212
      10/04/20141215
      11/04/2014121
      12/04/20140150
      13/04/2014091
      14/04/20141216
      15/04/201418
      16/04/20141212
      17/04/20141215
      18/04/2014121
      19/04/20140150
      20/04/2014091
      21/04/20141196
      22/04/2014142
      23/04/20141213
      24/04/20141248
      25/04/201412
      26/04/201404
      27/04/20140243
      28/04/2014(30th occur.)1196
      29/04/2014142
      30/04/20141213

       

      Desired result = 4099

       

      Can anyone help out?

       

      Thanks in advance for your help.

       

      Kind regards,

      Nuno