Canvas Table subtotals


I am trying to calculate subtotals in a table in canvas. Something like this (using the demodata):

Using the code:

| mapColumn name="year" expression={getCell "time" | formatdate "YYYY"} 
| ply by="year" by="state"  expression={math "sum(price)"}
| table
| render

At the end, I want to add another column with percentages, where the calculation would be each row for 2019 divided by the 2019 total (repeating for other years). I tried to calculate another column using ply to get the sum of price (keeping all other fields) but it turns out to be null all the time.

This type of calculation is something that I can do in canvas? Or only static columns that give me the total per column are allowed?

Thanks for any help!!

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.