<?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: help on a count for doing a pie chart in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/help-on-a-count-for-doing-a-pie-chart/m-p/496949#M194722</link>
    <description>&lt;P&gt;sorry , I misunderstood.&lt;/P&gt;

&lt;P&gt;First, try this to create a pie chart.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults count=20
| streamstats count as user_count
| eval username="test".user_count
| eval Building_AP=random()%3+1
| eval Building_IT=random()%3+1
| stats  count(eval(Building_AP==Building_IT)) as APnotITOP count(username) as Total
| eval Total = Total - APnotITOP
| eval tmp=1
| untable tmp category count
| fields - tmp
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;In this way, I think you should use &lt;CODE&gt;untable&lt;/CODE&gt;. Therefore,  &lt;CODE&gt;where&lt;/CODE&gt;  is not necessary,&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| search Building_IT=*
| stats  count(eval(Building_AP==Building_IT)) as APnotITOP count(USERNAME) as Total
| eval Total = Total - APnotITOP
| eval tmp=1
| untable tmp category count
| fields - tmp
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;thanks.&lt;/P&gt;</description>
    <pubDate>Thu, 03 Oct 2019 12:29:24 GMT</pubDate>
    <dc:creator>to4kawa</dc:creator>
    <dc:date>2019-10-03T12:29:24Z</dc:date>
    <item>
      <title>help on a count for doing a pie chart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-on-a-count-for-doing-a-pie-chart/m-p/496946#M194719</link>
      <description>&lt;P&gt;hi&lt;/P&gt;

&lt;P&gt;From the code below, I need to do a pie chart with 2 labels&lt;BR /&gt;
I am doing a first count in order to count the events  | where NOT (Building_AP = Building_IT) &lt;BR /&gt;
My question is simple&lt;BR /&gt;
How to display a second label in the pie chart which count the totality of the events less the events  | where NOT (Building_AP = Building_IT) ?&lt;BR /&gt;
It means that i need a label which count the % of events  | where NOT (Building_AP = Building_IT) and another label which count the % of the remaining events&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;`test` 
    [| inputlookup host.csv 
    | table host 
    | rename host as USERNAME ] 
| lookup YY.csv NAME as AP_NAME OUTPUT Building 
| lookup XX.csv HOSTNAME as USERNAME output BUILDING_CODE 
| eval Building=upper(Building) 
| stats last(Building) as Building_AP, last(BUILDING_CODE) as Building_IT by USERNAME 
| where NOT (Building_AP = Building_IT) AND isnotnull(Building_IT) 
| stats count as APnotITOP
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thanks for your help&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 02:27:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-on-a-count-for-doing-a-pie-chart/m-p/496946#M194719</guid>
      <dc:creator>jip31</dc:creator>
      <dc:date>2020-09-30T02:27:41Z</dc:date>
    </item>
    <item>
      <title>Re: help on a count for doing a pie chart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-on-a-count-for-doing-a-pie-chart/m-p/496947#M194720</link>
      <description>&lt;PRE&gt;&lt;CODE&gt; | where NOT (Building_AP = Building_IT) AND isnotnull(Building_IT) 
 | stats count as APnotITOP
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;⇨&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| search Building_IT=*
| fillnull Building_AP,Building_IT
| eval APnotITOP=(Building_IT / (Building_AP +Building_IT) * 100)."%"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;try it.&lt;/P&gt;</description>
      <pubDate>Wed, 02 Oct 2019 11:37:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-on-a-count-for-doing-a-pie-chart/m-p/496947#M194720</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2019-10-02T11:37:33Z</dc:date>
    </item>
    <item>
      <title>Re: help on a count for doing a pie chart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-on-a-count-for-doing-a-pie-chart/m-p/496948#M194721</link>
      <description>&lt;P&gt;You mean replace&lt;BR /&gt;
| where NOT (Building_AP = Building_IT) AND isnotnull(Building_IT) &lt;BR /&gt;
| stats count as APnotITOP&lt;BR /&gt;
By your code?&lt;BR /&gt;
If yes, what do you do about the where condition?&lt;BR /&gt;
I want to count the events where where NOT (Building_AP = Building_IT) AND isnotnull(Building_IT)  and to count also all the events in order to do a pie after deleting events where Building_IT is empty (thats why I use isnotnull(Building_IT) )&lt;BR /&gt;
So your query is not good &lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 02:27:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-on-a-count-for-doing-a-pie-chart/m-p/496948#M194721</guid>
      <dc:creator>jip31</dc:creator>
      <dc:date>2020-09-30T02:27:45Z</dc:date>
    </item>
    <item>
      <title>Re: help on a count for doing a pie chart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-on-a-count-for-doing-a-pie-chart/m-p/496949#M194722</link>
      <description>&lt;P&gt;sorry , I misunderstood.&lt;/P&gt;

&lt;P&gt;First, try this to create a pie chart.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults count=20
| streamstats count as user_count
| eval username="test".user_count
| eval Building_AP=random()%3+1
| eval Building_IT=random()%3+1
| stats  count(eval(Building_AP==Building_IT)) as APnotITOP count(username) as Total
| eval Total = Total - APnotITOP
| eval tmp=1
| untable tmp category count
| fields - tmp
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;In this way, I think you should use &lt;CODE&gt;untable&lt;/CODE&gt;. Therefore,  &lt;CODE&gt;where&lt;/CODE&gt;  is not necessary,&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| search Building_IT=*
| stats  count(eval(Building_AP==Building_IT)) as APnotITOP count(USERNAME) as Total
| eval Total = Total - APnotITOP
| eval tmp=1
| untable tmp category count
| fields - tmp
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;thanks.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Oct 2019 12:29:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-on-a-count-for-doing-a-pie-chart/m-p/496949#M194722</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2019-10-03T12:29:24Z</dc:date>
    </item>
    <item>
      <title>Re: help on a count for doing a pie chart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-on-a-count-for-doing-a-pie-chart/m-p/496950#M194723</link>
      <description>&lt;P&gt;sorry,I misunderstood.&lt;/P&gt;

&lt;P&gt;First, try this to create a pie chart.&lt;/P&gt;

&lt;P&gt;| makeresults count=20&lt;BR /&gt;
| streamstats count as user_count&lt;BR /&gt;
| eval username="test".user_count&lt;BR /&gt;
| eval Building_AP=random()%3+1&lt;BR /&gt;
| eval Building_IT=random()%3+1&lt;BR /&gt;
| stats  count(eval(Building_AP==Building_IT)) as APnotITOP count(username) as Total&lt;BR /&gt;
| eval Total = Total - APnotITOP&lt;BR /&gt;
| eval tmp=1&lt;BR /&gt;
| untable tmp category count&lt;BR /&gt;
| fields - tmp&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 02:22:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-on-a-count-for-doing-a-pie-chart/m-p/496950#M194723</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-09-30T02:22:45Z</dc:date>
    </item>
  </channel>
</rss>

