Splunk Search

## How to calculate through elements in MV field? Explorer

I have a table like this

 product_name test_result result_mv calc_output A 1 123 5 A 2 123 2 A 3 123 5 B 4 467 13 B 6 467 5 B 7 467 10

You can see thr MV field "result_mv".
Is the outcome of   | eventstats list(test_result) by product_name

And I have a customized func, for example:
Σ( ( test_result - result_mv[index] ) ^2)

Example of function output (calc_output):
(1-1)^2 + (1-2)^2 + (1-3)^2 = 0+1+4 = 5
(2-1)^2 + (2-2)^2 + (2-3)^2 = 1+0+1 = 2
(3-1)^2 + (3-2)^2 + (3-3)^2 = 4+1+0 = 5

(4-4)^2 + (4-6)^2 + (4-7)^2 = 0+4+9 = 13
(6-4)^2 + (6-6)^2 + (6-7)^2 = 4+0+1 = 5
(7-4)^2 + (7-6)^2 + (7-7)^2 = 9+1+0 = 10

Bottom line, I need create the "calc_output" through "result_mv" by "product_name" .

Labels (2)

• ### stats

1 Solution  SplunkTrust

Use this eval on your example table data, which will create calc_output as in your example

``| eval calc_output=sum(mvmap(result_mv, pow((test_result-result_mv),2)))``

If you want to then get totals by product_name, use eventstats or stats as needed.  SplunkTrust

Use this eval on your example table data, which will create calc_output as in your example

``| eval calc_output=sum(mvmap(result_mv, pow((test_result-result_mv),2)))``

If you want to then get totals by product_name, use eventstats or stats as needed. Get Updates on the Splunk Community!

#### Enterprise Security Content Update (ESCU) | New Releases

In the last month, the Splunk Threat Research Team (STRT) has had 2 releases of new security content via the ...

#### Announcing the 1st Round Champion’s Tribute Winners of the Great Resilience Quest

We are happy to announce the 20 lucky questers who are selected to be the first round of Champion's Tribute ...

#### We’ve Got Education Validation!

Are you feeling it? All the career-boosting benefits of up-skilling with Splunk? It’s not just a feeling, it's ...