I was able to calculate the sum of a column except the last row with the following table calc: sum(pivot_row(${TABLE.MEASURE:total})) - max(row())
Is there a way to apply similar logic to sum a column except the last 2 rows, last 3 rows, etc?
thanks in advance!
Solved! Go to Solution.
Ok figured it out.
Solution:
max(running_total(offset(${total_cohort_size}, -1)))
max(running_total(offset(${total_cohort_size}, -2)))
EDIT:
This logic is wrong: sum(pivot_row(${TABLE.MEASURE:total})) - max(row())
This resulted in subtracting the total row count and not the value in the last row.
Ok figured it out.
Solution:
max(running_total(offset(${total_cohort_size}, -1)))
max(running_total(offset(${total_cohort_size}, -2)))