runningSum issue

since i’m still rookie in QS world, looking for your help regarding following matter.

Case: I’m tying to calculate a cumulative sum of contracts by months as per below simple example:

Jan: 50 contracts
Feb: 150 contracts (50 created in Jan + 100 created inFeb)

I was testing calculated filed with runningSum but i’m getting errors when saving this one:

sum({Contract Id}),
[truncDate(“MM”,{created_at} ASC])

Could you advise if this function is a proper one and if not what’s the better approach?
Thanks in advance.

There’s a syntax error in your calculated field. One of your closing brackets is in the wrong position. The truncDate function doesn’t take ASC as argument. ASC should be part of the runningSum function and not in truncDate.

Can you try this instead?

sum({Contract Id}),
[truncDate(“MM”,{created_at}) ASC]

To see the syntax error more clearly, you can write the calculated fields separately instead of nesting them.
Month = truncDate(“MM”, {created_at})
Running Sum = runningSum( sum({Contract Id}), [{Month} ASC] )


@David_Wong thanks for your advice, i’ve solved it now.

1 Like