<?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 two where clause? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/two-where-clause/m-p/112884#M29654</link>
    <description>&lt;P&gt;Hi All.&lt;/P&gt;

&lt;P&gt;I want to calculate churned customers from two placements&lt;BR /&gt;
 (churn=0 means churned,1 as unchurned) and placement ( 0 means rural and 1 as urban).&lt;BR /&gt;
The query i have used.&lt;BR /&gt;
&lt;STRONG&gt;sourcetype="Customer_Churn"&lt;BR /&gt;&lt;BR /&gt;
| eventstats count(CHURN) by PLACEMENT&lt;BR /&gt;
| where CHURN="0" &lt;BR /&gt;
| eventstats count(CHURN) as c0p&lt;BR /&gt;
| eventstats count(CHURN)&lt;BR /&gt;
| where CHURN="0" AND PLACEMENT=0&lt;BR /&gt;
| eventstats count(CHURN) as c0p0&lt;BR /&gt;
| eval p=c0p0/c0p*100&lt;BR /&gt;
| stats values(p) by PLACEMENT&lt;BR /&gt;
| replace 0 with Rural in PLACEMENT &lt;BR /&gt;
| replace 1 with Urban in PLACEMENT&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;It is showing me only placement =0  ie. rural (rural=19.304), i want both to be displayed.&lt;BR /&gt;
rural=19.304 and urban=80.06&lt;/P&gt;

&lt;P&gt;Thanks a Million,&lt;BR /&gt;
Santhosh.  &lt;/P&gt;</description>
    <pubDate>Mon, 18 May 2015 14:40:58 GMT</pubDate>
    <dc:creator>SanthoshSreshta</dc:creator>
    <dc:date>2015-05-18T14:40:58Z</dc:date>
    <item>
      <title>two where clause?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/two-where-clause/m-p/112884#M29654</link>
      <description>&lt;P&gt;Hi All.&lt;/P&gt;

&lt;P&gt;I want to calculate churned customers from two placements&lt;BR /&gt;
 (churn=0 means churned,1 as unchurned) and placement ( 0 means rural and 1 as urban).&lt;BR /&gt;
The query i have used.&lt;BR /&gt;
&lt;STRONG&gt;sourcetype="Customer_Churn"&lt;BR /&gt;&lt;BR /&gt;
| eventstats count(CHURN) by PLACEMENT&lt;BR /&gt;
| where CHURN="0" &lt;BR /&gt;
| eventstats count(CHURN) as c0p&lt;BR /&gt;
| eventstats count(CHURN)&lt;BR /&gt;
| where CHURN="0" AND PLACEMENT=0&lt;BR /&gt;
| eventstats count(CHURN) as c0p0&lt;BR /&gt;
| eval p=c0p0/c0p*100&lt;BR /&gt;
| stats values(p) by PLACEMENT&lt;BR /&gt;
| replace 0 with Rural in PLACEMENT &lt;BR /&gt;
| replace 1 with Urban in PLACEMENT&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;It is showing me only placement =0  ie. rural (rural=19.304), i want both to be displayed.&lt;BR /&gt;
rural=19.304 and urban=80.06&lt;/P&gt;

&lt;P&gt;Thanks a Million,&lt;BR /&gt;
Santhosh.  &lt;/P&gt;</description>
      <pubDate>Mon, 18 May 2015 14:40:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/two-where-clause/m-p/112884#M29654</guid>
      <dc:creator>SanthoshSreshta</dc:creator>
      <dc:date>2015-05-18T14:40:58Z</dc:date>
    </item>
    <item>
      <title>Re: two where clause?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/two-where-clause/m-p/112885#M29655</link>
      <description>&lt;P&gt;Hi Santhosh,&lt;/P&gt;

&lt;P&gt;Try using stats with eval together as below:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype="Customer_Churn" |stats count(eval(CHURN==0)) AS totalChurn  count(eval(CHURN==0 AND PLATECEMENT==0)) AS ruralChurn   count(eval(CHURN==0 AND PLATECEMENT==1)) AS urbanChurn by sourcetype|eval ruralChurnPercentage = (ruralChurn*100)/totalChurn  |eval urbanChurnPercentage = (urbanChurn*100)/totalChurn|table  ruralChurnPercentage urbanChurnPercentage 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thanks,&lt;BR /&gt;
Sanjay&lt;/P&gt;</description>
      <pubDate>Mon, 18 May 2015 16:33:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/two-where-clause/m-p/112885#M29655</guid>
      <dc:creator>sanjay_shrestha</dc:creator>
      <dc:date>2015-05-18T16:33:36Z</dc:date>
    </item>
    <item>
      <title>Re: two where clause?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/two-where-clause/m-p/112886#M29656</link>
      <description>&lt;P&gt;Hi @Sanjay.shrestha ThankQ so much.!!!&lt;BR /&gt;
but one thing, as it is in table command, i am getting x-axis as ruralchurnpercentage and y-axis as urbanchurnpercentage. &lt;BR /&gt;
but i want y-axis as percentage from 1 to 100 and two columns as ruralchurnpercentage and urbanchurnpercentage.&lt;/P&gt;

&lt;P&gt;Thanks &amp;amp; Regards,&lt;BR /&gt;
Santhosh.&lt;/P&gt;</description>
      <pubDate>Tue, 19 May 2015 04:35:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/two-where-clause/m-p/112886#M29656</guid>
      <dc:creator>SanthoshSreshta</dc:creator>
      <dc:date>2015-05-19T04:35:29Z</dc:date>
    </item>
  </channel>
</rss>

