<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to calculate a score based on a field with different values and count the number of identical values by applying a multiplier? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-a-score-based-on-a-field-with-different-values/m-p/332057#M98767</link>
    <description>&lt;P&gt;You could try append the following to your search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval rate=case(
severity == "High", 5,
severity == "Medium", 4,
severity == "Low", 3,
severity == "Negligible", 2,
severity == "Unknown", 1)
| eval score=count*rate
| stats sum(score) as SCORE
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 11 Apr 2018 15:12:02 GMT</pubDate>
    <dc:creator>damien_chillet</dc:creator>
    <dc:date>2018-04-11T15:12:02Z</dc:date>
    <item>
      <title>How to calculate a score based on a field with different values and count the number of identical values by applying a multiplier?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-a-score-based-on-a-field-with-different-values/m-p/332056#M98766</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I want to calculate a score based on a field (severity) containing different values (High, Medium, Low). This field is linked to a security scan on software.&lt;/P&gt;

&lt;P&gt;I would like to count the number of identical values and apply a multiplier according to criticity) I get this table for a scan on a specific software&lt;/P&gt;

&lt;P&gt;severity count&lt;BR /&gt;
High 11&lt;BR /&gt;
Low 8&lt;BR /&gt;
Medium 14&lt;BR /&gt;
Negligible 23&lt;BR /&gt;
Unknown 1&lt;/P&gt;

&lt;P&gt;I would like the count field values to be added in this way&lt;/P&gt;

&lt;P&gt;Score = High*5 + Medium*4 + Low*3 + Negligible*2 + Unknown * 1&lt;/P&gt;

&lt;P&gt;The result on this example would be 11*5 + 14*4 + 9*3 + 23*2 + 1*1 Score = 185&lt;/P&gt;

&lt;P&gt;I tried with eval but I can't manage the conditions (High, medium,...)&lt;/P&gt;

&lt;P&gt;Do you have any idea what to do?&lt;/P&gt;

&lt;P&gt;Thank you in advance &lt;/P&gt;

&lt;P&gt;Sincerely.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 19:00:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-a-score-based-on-a-field-with-different-values/m-p/332056#M98766</guid>
      <dc:creator>skhedim</dc:creator>
      <dc:date>2020-09-29T19:00:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate a score based on a field with different values and count the number of identical values by applying a multiplier?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-a-score-based-on-a-field-with-different-values/m-p/332057#M98767</link>
      <description>&lt;P&gt;You could try append the following to your search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval rate=case(
severity == "High", 5,
severity == "Medium", 4,
severity == "Low", 3,
severity == "Negligible", 2,
severity == "Unknown", 1)
| eval score=count*rate
| stats sum(score) as SCORE
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 11 Apr 2018 15:12:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-a-score-based-on-a-field-with-different-values/m-p/332057#M98767</guid>
      <dc:creator>damien_chillet</dc:creator>
      <dc:date>2018-04-11T15:12:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate a score based on a field with different values and count the number of identical values by applying a multiplier?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-a-score-based-on-a-field-with-different-values/m-p/332058#M98768</link>
      <description>&lt;P&gt;Perfect ! Very effective, I did not know case it's very practical.&lt;BR /&gt;
Thanks !&lt;/P&gt;</description>
      <pubDate>Wed, 11 Apr 2018 15:19:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-a-score-based-on-a-field-with-different-values/m-p/332058#M98768</guid>
      <dc:creator>skhedim</dc:creator>
      <dc:date>2018-04-11T15:19:50Z</dc:date>
    </item>
  </channel>
</rss>

