Running total for % proportion

Hi all,
I’m currently struggling with below exercise: I want to calculate the % proportion as per below sample column D. Columns B/C are the total numbers as per each month. I’m currently able to calculate this by calculated fields but QS is returning only data added for specific month. The totals are not rolling up for following months. Is there any way to achieve this? I’m thinking is there any similar functions to runningSum for such cases?

To clarify: “All items” and “Valid items” fields are are being calcualted by distinct_count function. I don’t have ready calculations in input database.

I was testing percentOfTotal but apparently id doesn’t support distinct_count or calculated fields for that.

image

Thanks in advance for any hints.

Have you tried doing a running sum?

runningSum(distinct_count({id}),[{timestamp} ASC],[])

In regards to percentoftotal have you looked into this?

1 Like

Thanks @Max for getting back. Was testing runningSum but it’s failing when trying to calculate the % proportion for both sets of sums. Let me go through the thread you shared, could be useful.

1 Like