Calculate YTD (Year to Date) value from monthly transaction amounts

Hi @ajit555,

If I understand correctly you want to creating the rolling sum of amound for each Entity & line item combo over the total timeframe. So for each entity you need to calculate this:
image

You could loop over each entity & line item group, sort by year and month, then create a moving aggregate as attached.

You could use a mix of groupings on year or months to calculate specific aggregations, and if a month is 12 then add a ‘year-to-date flag’ but I think the moving aggregate is probably good enough to get you start.

moving aggregate.knwf (17.1 KB)

Regards,
Wali Khan

2 Likes