<?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: Pie Chart max value vs active value in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Pie-Chart-max-value-vs-active-value/m-p/330529#M98389</link>
    <description>&lt;P&gt;what are you tryin gto rename as &lt;CODE&gt;ActiveDevices&lt;/CODE&gt;? &lt;CODE&gt;count&lt;/CODE&gt; or &lt;CODE&gt;Mac_Address&lt;/CODE&gt;? the &lt;CODE&gt;as ActiveDevices&lt;/CODE&gt; should go after count if you're renaming that. and you want the total of all Mac_Addresses divided by &lt;CODE&gt;TotalCount&lt;/CODE&gt;?&lt;/P&gt;

&lt;P&gt;try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=nitro_prod_store|rename mac as Mac_Address | stats count as ActiveDevices by Mac_Address|stats sum(ActiveDevices) as ActiveDevices|eval TotalCount = 22000|fields TotalCount ActiveDevices
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 14 Apr 2017 13:23:02 GMT</pubDate>
    <dc:creator>cmerriman</dc:creator>
    <dc:date>2017-04-14T13:23:02Z</dc:date>
    <item>
      <title>Pie Chart max value vs active value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Pie-Chart-max-value-vs-active-value/m-p/330528#M98388</link>
      <description>&lt;P&gt;I want to create a pie chart that has a max value of 22000 (This is hard-coded in) then I have a variable list of Mac_Addresses that I want to total up and compare it to the 22000 (So like 19000/22000...14000/22000..17500/22000) &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=nitro_prod_store|rename mac as Mac_Address | stats count by Mac_Address as ActiveDevices |eval TotalCount = 22000|fields TotalCount ActiveDevices
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/2770iC27FC841EE469203/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Apr 2017 13:15:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Pie-Chart-max-value-vs-active-value/m-p/330528#M98388</guid>
      <dc:creator>JoshuaJohn</dc:creator>
      <dc:date>2017-04-14T13:15:12Z</dc:date>
    </item>
    <item>
      <title>Re: Pie Chart max value vs active value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Pie-Chart-max-value-vs-active-value/m-p/330529#M98389</link>
      <description>&lt;P&gt;what are you tryin gto rename as &lt;CODE&gt;ActiveDevices&lt;/CODE&gt;? &lt;CODE&gt;count&lt;/CODE&gt; or &lt;CODE&gt;Mac_Address&lt;/CODE&gt;? the &lt;CODE&gt;as ActiveDevices&lt;/CODE&gt; should go after count if you're renaming that. and you want the total of all Mac_Addresses divided by &lt;CODE&gt;TotalCount&lt;/CODE&gt;?&lt;/P&gt;

&lt;P&gt;try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=nitro_prod_store|rename mac as Mac_Address | stats count as ActiveDevices by Mac_Address|stats sum(ActiveDevices) as ActiveDevices|eval TotalCount = 22000|fields TotalCount ActiveDevices
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 14 Apr 2017 13:23:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Pie-Chart-max-value-vs-active-value/m-p/330529#M98389</guid>
      <dc:creator>cmerriman</dc:creator>
      <dc:date>2017-04-14T13:23:02Z</dc:date>
    </item>
    <item>
      <title>Re: Pie Chart max value vs active value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Pie-Chart-max-value-vs-active-value/m-p/330530#M98390</link>
      <description>&lt;P&gt;Give this a try.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=nitro_prod_store| stats count as ActiveDevices by mac |rename mac as Mac_Address | appendpipe [| stats sum(ActiveDevices) as ActiveDevices | eval Mac_Address=ActiveDevices."/22000"| eval ActiveDevices =22000-ActiveDevices ]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 14 Apr 2017 14:38:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Pie-Chart-max-value-vs-active-value/m-p/330530#M98390</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-04-14T14:38:42Z</dc:date>
    </item>
    <item>
      <title>Re: Pie Chart max value vs active value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Pie-Chart-max-value-vs-active-value/m-p/330531#M98391</link>
      <description>&lt;P&gt;Run anywhere sample of one easy way to do it...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults | eval ActiveDevices=17500
| rename COMMENT as "The above line just creates one test data record like your stats output."

| rename COMMENT as "This next section takes your stats output and creates one record for Active, one for Inactive."
| eval mycount = mvappend("Active=".ActiveDevices, "Inactive=".tonumber(22000-ActiveDevices)) 
| mvexpand mycount 
| rex field=mycount "(?&amp;lt;status&amp;gt;[^=]*)=(?&amp;lt;count&amp;gt;.*)"
| table status count

| rename COMMENT as "This renames the active status to have your desired format."
| rename COMMENT as "This could be done inside the first eval, but it would make the code less readable."
| eval status=if(status="Active",count."/22500 Active",status)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;...or, if it's the "Inactive" slice that you want labeled with the "Active" numbers... &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval status=if(status="Inactive",count."/22500",status)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 14 Apr 2017 14:44:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Pie-Chart-max-value-vs-active-value/m-p/330531#M98391</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-04-14T14:44:43Z</dc:date>
    </item>
    <item>
      <title>Re: Pie Chart max value vs active value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Pie-Chart-max-value-vs-active-value/m-p/330532#M98392</link>
      <description>&lt;P&gt;Thank you, this was incredibly helpful!&lt;/P&gt;</description>
      <pubDate>Mon, 17 Apr 2017 13:11:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Pie-Chart-max-value-vs-active-value/m-p/330532#M98392</guid>
      <dc:creator>JoshuaJohn</dc:creator>
      <dc:date>2017-04-17T13:11:34Z</dc:date>
    </item>
    <item>
      <title>Re: Pie Chart max value vs active value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Pie-Chart-max-value-vs-active-value/m-p/330533#M98393</link>
      <description>&lt;P&gt;Glad to oblige.&lt;/P&gt;</description>
      <pubDate>Mon, 17 Apr 2017 15:33:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Pie-Chart-max-value-vs-active-value/m-p/330533#M98393</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-04-17T15:33:17Z</dc:date>
    </item>
  </channel>
</rss>

