<?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: Is there a way to calculate percentile of a row values in table? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-calculate-percentile-of-a-row-values-in-table/m-p/473510#M133231</link>
    <description>&lt;P&gt;Hi @akarivaratharaj ,&lt;BR /&gt;
Try below statistics function to get 95th percentile-&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|makeresults|eval month="Jan", host1="40", host2="50", host3="70"
|append[|makeresults|eval month="Feb", host1="60", host2="50", host3="30"]
|addtotals| stats perc95(Total) as "p95(Host)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Till makeresults is used to generate raw data only.&lt;BR /&gt;
refer-&lt;A href="https://docs.splunk.com/Documentation/Splunk/8.0.1/SearchReference/Aggregatefunctions#percentile_.3CX.3E.28Y.29"&gt;https://docs.splunk.com/Documentation/Splunk/8.0.1/SearchReference/Aggregatefunctions#percentile_.3CX.3E.28Y.29&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 18 Feb 2020 09:24:53 GMT</pubDate>
    <dc:creator>493669</dc:creator>
    <dc:date>2020-02-18T09:24:53Z</dc:date>
    <item>
      <title>Is there a way to calculate percentile of a row values in table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-calculate-percentile-of-a-row-values-in-table/m-p/473509#M133230</link>
      <description>&lt;P&gt;I have displayed percentile of certain metric values by grouping with month &amp;amp; host in a table representation. Whatever host category, we select from the dropdown, the value of the metrics will be displayed for each of its hosts. No. of servers in each host category will differs. &lt;/P&gt;

&lt;P&gt;As like addtotals I want to take percentile of my entire row values. Below are sample data from my table panel.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Month  host1  host2  host3
Jan     90     40     78
Feb     36     27     56
:
Dec     12     49     22
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The command &lt;CODE&gt;addtotals&lt;/CODE&gt; will sum all the values of a row and provide one more column with the cumulative value. But in my case instead of sum I want to do percentile of all those values. Below is the way I wanted&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Month  host1  host2  host3  P95(host)
Jan     90     40     78
Feb     36     27     56
:
Dec     12     49     22
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Could anyone help me on this asap?&lt;/P&gt;</description>
      <pubDate>Tue, 18 Feb 2020 09:10:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-calculate-percentile-of-a-row-values-in-table/m-p/473509#M133230</guid>
      <dc:creator>akarivaratharaj</dc:creator>
      <dc:date>2020-02-18T09:10:01Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to calculate percentile of a row values in table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-calculate-percentile-of-a-row-values-in-table/m-p/473510#M133231</link>
      <description>&lt;P&gt;Hi @akarivaratharaj ,&lt;BR /&gt;
Try below statistics function to get 95th percentile-&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|makeresults|eval month="Jan", host1="40", host2="50", host3="70"
|append[|makeresults|eval month="Feb", host1="60", host2="50", host3="30"]
|addtotals| stats perc95(Total) as "p95(Host)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Till makeresults is used to generate raw data only.&lt;BR /&gt;
refer-&lt;A href="https://docs.splunk.com/Documentation/Splunk/8.0.1/SearchReference/Aggregatefunctions#percentile_.3CX.3E.28Y.29"&gt;https://docs.splunk.com/Documentation/Splunk/8.0.1/SearchReference/Aggregatefunctions#percentile_.3CX.3E.28Y.29&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Feb 2020 09:24:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-calculate-percentile-of-a-row-values-in-table/m-p/473510#M133231</guid>
      <dc:creator>493669</dc:creator>
      <dc:date>2020-02-18T09:24:53Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to calculate percentile of a row values in table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-calculate-percentile-of-a-row-values-in-table/m-p/473511#M133232</link>
      <description>&lt;P&gt;Close, but use streamstats,  and optionally remove the Total field:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|makeresults|eval month="Jan", host1="40", host2="50", host3="70"
|append[|makeresults|eval month="Feb", host1="60", host2="50", host3="30"]
|eval comment="Everything above this line makes sample data" |fields - comment
|addtotals| streamstats perc95(Total) as "p95(Host)"
| fields - Total
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 18 Feb 2020 11:01:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-calculate-percentile-of-a-row-values-in-table/m-p/473511#M133232</guid>
      <dc:creator>nickhills</dc:creator>
      <dc:date>2020-02-18T11:01:04Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to calculate percentile of a row values in table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-calculate-percentile-of-a-row-values-in-table/m-p/473512#M133233</link>
      <description>&lt;P&gt;@493669  @nickhillscpl  Both of your methods are doing addition, which gives a single value nothing but sum of all the values and taking percentile upon that single value.&lt;/P&gt;

&lt;P&gt;This will obviously give the same values as of Total value itself. Please refer the below output I got.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;p95(Host)   Total
294.25  294.25
793.68  793.68
296.69  296.69
2552.53 2552.53
2160.30 2160.30
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;My case is, there should be any addition at all, instead of the function &lt;CODE&gt;sum&lt;/CODE&gt; (which is automatically done via &lt;CODE&gt;addtotals&lt;/CODE&gt; command) there should be the function &lt;CODE&gt;Percentile&lt;/CODE&gt; for whichever values we need for each row items&lt;/P&gt;</description>
      <pubDate>Tue, 18 Feb 2020 11:23:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-calculate-percentile-of-a-row-values-in-table/m-p/473512#M133233</guid>
      <dc:creator>akarivaratharaj</dc:creator>
      <dc:date>2020-02-18T11:23:35Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to calculate percentile of a row values in table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-calculate-percentile-of-a-row-values-in-table/m-p/473513#M133234</link>
      <description>&lt;P&gt;For now, I have tried using the percentile function for the specific values in one query and appended to my first query. With that I get percentile of each row values.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;Base query&amp;gt;
|search Host_Type=*
| chart useother=f limit=100 values(metric_perc) as "Metric(%)" over Month by Host
|appendcols [
|search Host_Type=*
| stats P95(metric_perc) as "Cumulative P95 of Hosts" by Month
]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;With this query I got the expected answer. As like &lt;CODE&gt;addtotals OR addcoltotals&lt;/CODE&gt; if we have for Percentile or Max or any other aggregate functions, it will be useful. Because at the end of the results its just need to add one single command, and no need to repeat the query and use append command.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Feb 2020 11:31:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-calculate-percentile-of-a-row-values-in-table/m-p/473513#M133234</guid>
      <dc:creator>akarivaratharaj</dc:creator>
      <dc:date>2020-02-18T11:31:57Z</dc:date>
    </item>
  </channel>
</rss>

