Could I Show "SUM(field_a) / SUM(field_b)" value in report?

TI5
Kilo Contributor

Suppose that there are the following records in pm_project_task table.
(field_for_groupby, field_a and field_b are custom field.)

 

field_for_groupbyfield_afield_b
GroupA8391406
GroupA3991302
GroupA842598
GroupA2697044
GroupA1077695
GroupB391406
GroupB591302
GroupB22598
GroupB797044
GroupB277695

 

I would like to display the value of "SUM(field_a) divided by SUM(field_b)" in the report.

However, the report designer has only the following items in the aggregation options.

find_real_file.png

 

What should I do ?

 

=====

I've added some information. 

If the value I want to display is expressed in SQL, it will be as follows.


SELECT SUM(field_a) / SUM(field_b) FROM pm_project_task GROUP BY field_for_groupby

 

5 REPLIES 5

TI5
Kilo Contributor

Hello, Allen.

 

Use function field to divide field_a by field_b,
Do you mean you just need to sum those values?

 

I tried to use a function field.

 

I set it up as follows.

(u_testing_failure_count stands for field_a, u_kilo_step_count_total stands for field_b.)

find_real_file.png

 

And then,  the aggregation settings is as below.

find_real_file.png

GroupA total is 0.034064382.

The breakdown is as follows.

(83 / 91406) + (39 / 91302) + (84 / 2598) + (26 / 97044) + (10 / 77695) = 0.034064382

 

What I want to do is the sum of the field_a values ​​of the five records in the group divide by field_b of the same group. The calculation is as follows.

(83 + 39 + 84 + 26 + 10 ) / (91406 + 91302 + 2598 + 97044 + 77695) = 0.000672138

 

After all, I decided to deal with it as follows.

Calculate the total value in the same group in advance, insert it into the table created to store the value, use this table as the data source in the report designer, and use function field to divide the total value of the field_a by the total value of the field_b and display the value on the graph.

 

Excuse me for my insufficient explanation.

Thank you, Allen.