I need dynamically generated field. Suppose I have Subject1 and Subject2 terms or fields and values are 40 and 50 respectively. In data table I need percentage term dynamically based on these two fields. I am taking only one field for aggregation i.e. Subject1 then percentage term should display percentage of Subject1 only. And if we are taking both fields Subject1 and Subject2 then percentage field should display percentage of both fields.
I have created scripted field like this ((doc['Math'].value+doc['English'].value)/200)*100 and field name is percentage. But its not dynamic. Based on selected fields in aggregation percentage should display.
Please provide solution.