I was wondering if it was possible to add a new column to a data table in a Visualize from a calculation based on two different columns in the same row
Say I have two columns Calls A and Calls B I want to create a third column say Total Calls which is the sum of Calls A + Calls B.
Call A is a Metric sum of calls_a Call B is a Metric sum of calls_b
i.e.
Calls A | Calls B | Total Calls
Ottawa 1 2 3
Toronto 5 4 9
Nunavik 0 0 0
Thanks for your quick reply and it work perfectly. I have a follow up question.
If I wanted to create another new column call Call A Percentage, what would the script look like for that?
I think I'm close, but don't know what syntax to put around 'totalCalls ':
def call_a_percentage = doc['Calls A'].value / 'totalCalls '; return call_a_percentage ;
Create a new script field "Call A Percentage" (Type: painless)
def call_a_percentage = doc['Calls A'].value / 'totalCalls ';
click save
Then just select the " call_a_percentage "field (under fields) and click pencil icon and change the format to percentage then click save field..This should give you the Call A Percentage..
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.