php-reports icon indicating copy to clipboard operation
php-reports copied to clipboard

Add a percent between columns in a Rollup solution to Wiki

Open angra1982 opened this issue 9 years ago • 0 comments

Hi, first at all the project is amazing!. Excelent work.

I had problems by finding a way to add a percent between two columns. I didn´t found on internet how to do that, so I had read all php code and twig to understand how to add a percent in a rollup. Finally I found the way. For example, I have 3 columns (A, B, C=A/B * 100). C is the percent between A and B.

That was my solution:

-- ROLLUP: { -- columns: { -- "A": "{{sum}}", -- "B": "{{sum}}", -- "C": "{{ (row['A']['sum'] / row['B']['sum'] * 100) | round( 2, 'common') }}" -- } -- }

Could be really great add this information in the Wiki in order to help someone else to do this percent between columns.

angra1982 avatar Jul 12 '16 19:07 angra1982