Hello all,
Currently I have acquired a timechart in the format:
Field_A / Field_B / Field_C / Field_D / Total
//// 10 ///////// 20 ///////// 15 ////////// 5 //////// 50
etc. using the | addtotals command.
I would like to somehow change each column to represent a percentage of the total to wind up with something like:
Field_A / Field_B / Field_C / Field_D
//// 0.2 //////// 0.4 //////// 0.3 ///////// 0.1
Thanks very much. Any help would be greatly appreciated!
hello there,
there are many ways to achieve, if you keep naming convention, maybe try the foreach
command. here is one example with eval
to create desired values. run this search anywhere:
| gentimes start="10/15/2018:00:00:00" end="10/15/2018:10:00:00" increment=15min
| eval _time = starttime
| eval field_a = random()%100
| eval field_b = random()%100
| eval field_c = random()%100
| eval field_d = random()%100
| eval total = field_a + field_b + field_c + field_d
| table _time field* total
| rename COMMENT as "the above creates data, below is the solution"
| eval field_a_perc = round(field_a/total*100, 2)
| eval field_b_perc = round(field_b/total*100, 2)
| eval field_c_perc = round(field_c/total*100, 2)
| eval field_d_perc = round(field_d/total*100, 2)
| timechart span=15m max(field_a_perc) as field_a_perc max(field_b_perc) as field_b_perc max(field_c_perc) as field_c_perc max(field_d_perc) as field_d_perc
screenshot:
hope it helps