<?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: Forcing Results Into a Pie Chart and Calculating Percentages In a Table - From the Same Query in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Forcing-Results-Into-a-Pie-Chart-and-Calculating-Percentages-In/m-p/42213#M9837</link>
    <description>&lt;P&gt;sourcetype=videoplaybacklog&lt;BR /&gt;
| stats count(eval(event="VIDEO_START")) as VS, count(eval(event="PLAYBACK_ERROR")) as PE, count(eval(event="VIDEO_START_ERROR")) as VSE &lt;BR /&gt;
| eval A=VS-PE &lt;BR /&gt;
| eval B=VSE+PE &lt;BR /&gt;
| table A B &lt;BR /&gt;
| transpose &lt;BR /&gt;
| rename column as Type &lt;BR /&gt;
| rename "row 1" as "Count"&lt;BR /&gt;
| eventstats sum(Count) as c&lt;BR /&gt;
| eval Percent=Count/c*100&lt;BR /&gt;
| table Type Count Percent&lt;/P&gt;</description>
    <pubDate>Mon, 28 Sep 2020 12:18:53 GMT</pubDate>
    <dc:creator>tfletcher_splun</dc:creator>
    <dc:date>2020-09-28T12:18:53Z</dc:date>
    <item>
      <title>Forcing Results Into a Pie Chart and Calculating Percentages In a Table - From the Same Query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Forcing-Results-Into-a-Pie-Chart-and-Calculating-Percentages-In/m-p/42210#M9834</link>
      <description>&lt;P&gt;I have a video player that logs the following:&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;Video Starts - When a user clicks play and the first frame of the video is delivered&lt;/LI&gt;
&lt;LI&gt;Video Start Errors - When a user clicks play and the first frame of the video is not delivered (due to an error)&lt;/LI&gt;
&lt;LI&gt;Playback Errors - When a user clicks play, and the first frame of the video is delivered, and an error is thrown any time after&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;Please note the following two events are NOT logged: user closes the video, or the video naturally completes playback.&lt;/P&gt;

&lt;P&gt;I've successfully created a query that shows the total user "attempts" to play a video (presented on a Splunk dashboard), and graphs the results in a pie chart split into two chunks:&lt;/P&gt;

&lt;P&gt;A. Successful Video Playback Sessions&lt;BR /&gt;
B. Errored Out Video Sessions&lt;/P&gt;

&lt;P&gt;I have the above accomplished thus far, but I also need a the table of the results (same query, different panel and panel visualization type on the dashboard) to display the % each of the above A and B) represent vs. the total attempts.&lt;/P&gt;

&lt;P&gt;I'm calculating A and B via the following query:&lt;/P&gt;

&lt;P&gt;sourcetype=videoplaybacklog&lt;BR /&gt;
| stats count(eval(event="VIDEO_START")) as VS, count(eval(event="PLAYBACK_ERROR")) as PE, count(eval(event="VIDEO_START_ERROR")) as VSE &lt;BR /&gt;
| eval A=VS-PE &lt;BR /&gt;
| eval B=VSE+PE &lt;BR /&gt;
| table A B &lt;BR /&gt;
| transpose &lt;BR /&gt;
| rename column as Type &lt;BR /&gt;
| rename "row 1" as "count"&lt;/P&gt;

&lt;P&gt;This query gives me the pie chart I need in the first dashboard chart panel, but not the % in table that I need in the second dashboard table panel.&lt;/P&gt;

&lt;P&gt;I've tried the TOP command (instead of table) and adding in the logic to show the % A and B represent of the total attempts, but the top command returns the results in a single row, and doesn't graph nicely in the pie chart.&lt;/P&gt;

&lt;P&gt;Any suggestions?&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 12:18:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Forcing-Results-Into-a-Pie-Chart-and-Calculating-Percentages-In/m-p/42210#M9834</guid>
      <dc:creator>fncds3</dc:creator>
      <dc:date>2020-09-28T12:18:45Z</dc:date>
    </item>
    <item>
      <title>Re: Forcing Results Into a Pie Chart and Calculating Percentages In a Table - From the Same Query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Forcing-Results-Into-a-Pie-Chart-and-Calculating-Percentages-In/m-p/42211#M9835</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;sourcetype=videoplaybacklog
| stats count(eval(event="VIDEO_START")) as VS, count(eval(event="PLAYBACK_ERROR")) as PE, count(eval(event="VIDEO_START_ERROR")) as VSE 
| eval A=(VS-PE)/(VS+VSE) * 100
| eval B=(VSE+PE)/(VS+VSE) * 100 
| table A B 
| transpose 
| rename column as Type 
| rename "row 1" as "Percent"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;That gets you the percent, you could run your search and this one to get the two visualizations, Or just this one to fuel both, but then you'd lose the count in the tooltip. The best thing is probably to go to advanced xml and use a Post Process&lt;/P&gt;</description>
      <pubDate>Wed, 22 Aug 2012 17:56:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Forcing-Results-Into-a-Pie-Chart-and-Calculating-Percentages-In/m-p/42211#M9835</guid>
      <dc:creator>tfletcher_splun</dc:creator>
      <dc:date>2012-08-22T17:56:44Z</dc:date>
    </item>
    <item>
      <title>Re: Forcing Results Into a Pie Chart and Calculating Percentages In a Table - From the Same Query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Forcing-Results-Into-a-Pie-Chart-and-Calculating-Percentages-In/m-p/42212#M9836</link>
      <description>&lt;P&gt;Thank you for the help! Unfortunately I need both count and percentage in the table view, and the above changes you suggest replace count. Any ideas?&lt;/P&gt;</description>
      <pubDate>Wed, 22 Aug 2012 20:12:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Forcing-Results-Into-a-Pie-Chart-and-Calculating-Percentages-In/m-p/42212#M9836</guid>
      <dc:creator>fncds3</dc:creator>
      <dc:date>2012-08-22T20:12:38Z</dc:date>
    </item>
    <item>
      <title>Re: Forcing Results Into a Pie Chart and Calculating Percentages In a Table - From the Same Query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Forcing-Results-Into-a-Pie-Chart-and-Calculating-Percentages-In/m-p/42213#M9837</link>
      <description>&lt;P&gt;sourcetype=videoplaybacklog&lt;BR /&gt;
| stats count(eval(event="VIDEO_START")) as VS, count(eval(event="PLAYBACK_ERROR")) as PE, count(eval(event="VIDEO_START_ERROR")) as VSE &lt;BR /&gt;
| eval A=VS-PE &lt;BR /&gt;
| eval B=VSE+PE &lt;BR /&gt;
| table A B &lt;BR /&gt;
| transpose &lt;BR /&gt;
| rename column as Type &lt;BR /&gt;
| rename "row 1" as "Count"&lt;BR /&gt;
| eventstats sum(Count) as c&lt;BR /&gt;
| eval Percent=Count/c*100&lt;BR /&gt;
| table Type Count Percent&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 12:18:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Forcing-Results-Into-a-Pie-Chart-and-Calculating-Percentages-In/m-p/42213#M9837</guid>
      <dc:creator>tfletcher_splun</dc:creator>
      <dc:date>2020-09-28T12:18:53Z</dc:date>
    </item>
    <item>
      <title>Re: Forcing Results Into a Pie Chart and Calculating Percentages In a Table - From the Same Query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Forcing-Results-Into-a-Pie-Chart-and-Calculating-Percentages-In/m-p/42214#M9838</link>
      <description>&lt;P&gt;The table format appears correctly when I run the search, and the "Type" column has the correct variable names. However there is no data in the results under the "Count" or "Percent" columns (not even "0" appears, just blank spots). I thought maybe my Splunk instance was on the fritz, so I sent the query to my pie chart and still no dice (no chart appeared).&lt;/P&gt;

&lt;P&gt;Any ideas?&lt;/P&gt;

&lt;P&gt;(Thank you for your continued help by the way!)&lt;/P&gt;</description>
      <pubDate>Thu, 23 Aug 2012 18:48:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Forcing-Results-Into-a-Pie-Chart-and-Calculating-Percentages-In/m-p/42214#M9838</guid>
      <dc:creator>fncds3</dc:creator>
      <dc:date>2012-08-23T18:48:32Z</dc:date>
    </item>
    <item>
      <title>Re: Forcing Results Into a Pie Chart and Calculating Percentages In a Table - From the Same Query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Forcing-Results-Into-a-Pie-Chart-and-Calculating-Percentages-In/m-p/42215#M9839</link>
      <description>&lt;P&gt;alright so I was trying to keep your main search, but I think this is better:&lt;BR /&gt;
sourcetype=videoplaybacklog | stats count by event | rename event as type | eval check=if(event=="PLAYBACK_ERROR","pe","vs") | eval pec=if(type=="PLAYBACK_ERROR",count,0) | eventstats sum(count) as tot by check | eventstats sum(pec) as pec | search type!="PLAYBACK_ERROR" | eval count=if(type=="VIDEO_START_ERROR",count+pec,count-pec) | eval type=if(type=="VIDEO_START_ERROR","Failed","Success") | eval pct=count/tot*100 | table type count pct&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 12:19:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Forcing-Results-Into-a-Pie-Chart-and-Calculating-Percentages-In/m-p/42215#M9839</guid>
      <dc:creator>tfletcher_splun</dc:creator>
      <dc:date>2020-09-28T12:19:34Z</dc:date>
    </item>
    <item>
      <title>Re: Forcing Results Into a Pie Chart and Calculating Percentages In a Table - From the Same Query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Forcing-Results-Into-a-Pie-Chart-and-Calculating-Percentages-In/m-p/42216#M9840</link>
      <description>&lt;P&gt;The query runs, but returns "No results found.".&lt;/P&gt;</description>
      <pubDate>Fri, 24 Aug 2012 17:45:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Forcing-Results-Into-a-Pie-Chart-and-Calculating-Percentages-In/m-p/42216#M9840</guid>
      <dc:creator>fncds3</dc:creator>
      <dc:date>2012-08-24T17:45:22Z</dc:date>
    </item>
    <item>
      <title>Re: Forcing Results Into a Pie Chart and Calculating Percentages In a Table - From the Same Query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Forcing-Results-Into-a-Pie-Chart-and-Calculating-Percentages-In/m-p/42217#M9841</link>
      <description>&lt;P&gt;I tried disassembling the query to see if each individual part worked, and I'm not getting any results from the following:&lt;/P&gt;

&lt;P&gt;sourcetype=videoplaybacklog &lt;BR /&gt;
| stats count by event &lt;BR /&gt;
| rename event as type &lt;BR /&gt;
| table type&lt;/P&gt;

&lt;P&gt;I wanted to see what "stats count by event" would show, and I still get "No results found.".&lt;/P&gt;</description>
      <pubDate>Fri, 24 Aug 2012 17:49:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Forcing-Results-Into-a-Pie-Chart-and-Calculating-Percentages-In/m-p/42217#M9841</guid>
      <dc:creator>fncds3</dc:creator>
      <dc:date>2012-08-24T17:49:08Z</dc:date>
    </item>
    <item>
      <title>Re: Forcing Results Into a Pie Chart and Calculating Percentages In a Table - From the Same Query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Forcing-Results-Into-a-Pie-Chart-and-Calculating-Percentages-In/m-p/42218#M9842</link>
      <description>&lt;P&gt;I was making assumptions about the structure of your data, event was meant to be the field that contained the values: PLAYBACK_ERROR VIDEO_START_ERROR etc. If you want more help post at least 1 of each type of event returned by:&lt;BR /&gt;
sourcetype=videoplaybacklog&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 12:19:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Forcing-Results-Into-a-Pie-Chart-and-Calculating-Percentages-In/m-p/42218#M9842</guid>
      <dc:creator>tfletcher_splun</dc:creator>
      <dc:date>2020-09-28T12:19:52Z</dc:date>
    </item>
    <item>
      <title>Re: Forcing Results Into a Pie Chart and Calculating Percentages In a Table - From the Same Query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Forcing-Results-Into-a-Pie-Chart-and-Calculating-Percentages-In/m-p/42219#M9843</link>
      <description>&lt;P&gt;I think that adding the last 3 lines below should add the percentage to your orignal data&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=videoplaybacklog
| stats count(eval(event="VIDEO_START")) as VS, count(eval(event="PLAYBACK_ERROR")) as PE, count(eval(event="VIDEO_START_ERROR")) as VSE 
| eval A=VS-PE 
| eval B=VSE+PE 
| table A B 
| transpose 
| rename column as Type 
| rename "row 1" as "count"
| eventstats sum(count) as total
| eval percent = round(count*100/total, 0)
| fields - total
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 24 Aug 2012 18:31:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Forcing-Results-Into-a-Pie-Chart-and-Calculating-Percentages-In/m-p/42219#M9843</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2012-08-24T18:31:20Z</dc:date>
    </item>
    <item>
      <title>Re: Forcing Results Into a Pie Chart and Calculating Percentages In a Table - From the Same Query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Forcing-Results-Into-a-Pie-Chart-and-Calculating-Percentages-In/m-p/42220#M9844</link>
      <description>&lt;P&gt;This did the trick. Thank you for you help!&lt;/P&gt;</description>
      <pubDate>Tue, 28 Aug 2012 15:15:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Forcing-Results-Into-a-Pie-Chart-and-Calculating-Percentages-In/m-p/42220#M9844</guid>
      <dc:creator>fncds3</dc:creator>
      <dc:date>2012-08-28T15:15:55Z</dc:date>
    </item>
    <item>
      <title>Re: Forcing Results Into a Pie Chart and Calculating Percentages In a Table - From the Same Query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Forcing-Results-Into-a-Pie-Chart-and-Calculating-Percentages-In/m-p/42221#M9845</link>
      <description>&lt;P&gt;tfletcher, thank you for your continued help throughout this process, I appreciate it!&lt;/P&gt;</description>
      <pubDate>Tue, 28 Aug 2012 15:18:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Forcing-Results-Into-a-Pie-Chart-and-Calculating-Percentages-In/m-p/42221#M9845</guid>
      <dc:creator>fncds3</dc:creator>
      <dc:date>2012-08-28T15:18:40Z</dc:date>
    </item>
    <item>
      <title>Re: Forcing Results Into a Pie Chart and Calculating Percentages In a Table - From the Same Query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Forcing-Results-Into-a-Pie-Chart-and-Calculating-Percentages-In/m-p/42222#M9846</link>
      <description>&lt;P&gt;Amazing &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Feb 2013 22:12:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Forcing-Results-Into-a-Pie-Chart-and-Calculating-Percentages-In/m-p/42222#M9846</guid>
      <dc:creator>cmak</dc:creator>
      <dc:date>2013-02-07T22:12:32Z</dc:date>
    </item>
    <item>
      <title>Re: Forcing Results Into a Pie Chart and Calculating Percentages In a Table - From the Same Query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Forcing-Results-Into-a-Pie-Chart-and-Calculating-Percentages-In/m-p/572009#M199334</link>
      <description>&lt;PRE&gt;| rename column as Type 
| rename "row 1" as "count"&lt;/PRE&gt;&lt;P&gt;was the trick, I think space between row and 1 makes bad effect.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Oct 2021 12:33:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Forcing-Results-Into-a-Pie-Chart-and-Calculating-Percentages-In/m-p/572009#M199334</guid>
      <dc:creator>splunkreal</dc:creator>
      <dc:date>2021-10-22T12:33:23Z</dc:date>
    </item>
  </channel>
</rss>

