<?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: How can i use stats in below mentioned Query? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-can-i-use-stats-in-below-mentioned-Query/m-p/242887#M72266</link>
    <description>&lt;P&gt;I Re-framed the query which u sent and got the result sundareshr . &lt;BR /&gt;
Thank you very much.&lt;/P&gt;</description>
    <pubDate>Tue, 24 Nov 2015 14:24:36 GMT</pubDate>
    <dc:creator>shankaranantht</dc:creator>
    <dc:date>2015-11-24T14:24:36Z</dc:date>
    <item>
      <title>How can i use stats in below mentioned Query?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-i-use-stats-in-below-mentioned-Query/m-p/242881#M72260</link>
      <description>&lt;P&gt;Find below mentioned data &lt;/P&gt;

&lt;P&gt;Applicationname  |Partners |    Servicename |   status &lt;BR /&gt;
DEE |  WEEEEE |Money Transfer|Success&lt;BR /&gt;
DDD |CDDDDD |   Money Transfer |    Success&lt;BR /&gt;
DDD |FFFFFFF|Money Transfer |Failed&lt;BR /&gt;
AAA |WEEEEE |In Payee hand |Success&lt;BR /&gt;
DEE |WEEEEE |In Payee hand |Success&lt;BR /&gt;
DDD|CDDDDD |In Payee hand |Success&lt;BR /&gt;
AAA |WEEEEE|Money Transfer |Success&lt;BR /&gt;
AAA |WEEEEE |Money Validate |Success&lt;BR /&gt;
AAA |WEEEEE |Money Receive |Success&lt;BR /&gt;
AAA |WEEEEE |Cross Verify |Success&lt;/P&gt;

&lt;P&gt;I have framed the query like &lt;/P&gt;

&lt;P&gt;Sample Query&lt;/P&gt;

&lt;P&gt;Source =data.csv&lt;BR /&gt;
| eval status=if(isnotnull(Error), "Failed", "Success") &lt;BR /&gt;
| eval Failcount=case(Status="Failed",1) | eval Successcount=case(Status="Success",1) &lt;BR /&gt;
| stats count(Status) as Total_Transactions count(Failcount)  as Failed_Transactions count(Successcount) as Success_Transactions values(Servicename) as Servicename &lt;BR /&gt;
 values(Applicationname) as Applicationname  by PartnerId&lt;BR /&gt;
| table partnerids ApplicationName ServiceName Success_Transactions Failed_Transactions Total_Transactions&lt;/P&gt;

&lt;P&gt;I need the result as mentioned in the attachment, can someone help me please&lt;/P&gt;

&lt;P&gt;Thanks in  advance &lt;BR /&gt;
&lt;IMG src="https://community.splunk.com/storage/temp/73207-data-result.jpg" alt="alt text" /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 07:57:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-i-use-stats-in-below-mentioned-Query/m-p/242881#M72260</guid>
      <dc:creator>shankaranantht</dc:creator>
      <dc:date>2020-09-29T07:57:28Z</dc:date>
    </item>
    <item>
      <title>Re: How can i use stats in below mentioned Query?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-i-use-stats-in-below-mentioned-Query/m-p/242882#M72261</link>
      <description>&lt;P&gt;This should give you what you are looking for &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source=data.csv 
| chart values(Partners) as Partners  list(Servicename) as Service list(eval(if(status="Success", 1, 0))) as Success list(eval(if(status="Failed", 1, 0))) as Fail count(status) as Txns over Applicationname
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 23 Nov 2015 15:45:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-i-use-stats-in-below-mentioned-Query/m-p/242882#M72261</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2015-11-23T15:45:47Z</dc:date>
    </item>
    <item>
      <title>Re: How can i use stats in below mentioned Query?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-i-use-stats-in-below-mentioned-Query/m-p/242883#M72262</link>
      <description>&lt;P&gt;Thank u very much sundaresh.&lt;/P&gt;

&lt;P&gt;There was a small changes need to be done in the query, but i was unable to do it.&lt;BR /&gt;
I cannot able to get the expected result.&lt;BR /&gt;
Note: kindly find the attachment for my expected result.&lt;/P&gt;

&lt;P&gt;I'm using the below query.&lt;/P&gt;

&lt;P&gt;source=data.csv &lt;BR /&gt;
| eval status=if(isnotnull(Error), "Failed", "Success") &lt;BR /&gt;
|eval partnerids = coalesce(partnerid,PartnerId)&lt;BR /&gt;
| chart values(ApplicationName) as ApplicationName values(ServiceName) as ServiceName list(eval(if(status="Success", 1, 0))) as Succalt textess&lt;BR /&gt;
values(eval(if(status="Failed", 1, 0))) as Fail count(status) as Txns over partnerids&lt;/P&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/836i9575517CA9EFF196/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>Tue, 24 Nov 2015 09:49:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-i-use-stats-in-below-mentioned-Query/m-p/242883#M72262</guid>
      <dc:creator>shankaranantht</dc:creator>
      <dc:date>2015-11-24T09:49:34Z</dc:date>
    </item>
    <item>
      <title>Re: How can i use stats in below mentioned Query?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-i-use-stats-in-below-mentioned-Query/m-p/242884#M72263</link>
      <description>&lt;P&gt;Thank u very much sundaresh.&lt;/P&gt;

&lt;P&gt;There was a small changes need to be done in the query, but i was unable to do it.&lt;BR /&gt;
I cannot able to get the expected result.&lt;/P&gt;

&lt;P&gt;I need the result as mentioned below .&lt;/P&gt;

&lt;P&gt;Applicationname     partner        ServiceName      Succescount    failcount    Total&lt;BR /&gt;
   AAA                          WEEEEE       In Payee hand             12               0                  67&lt;BR /&gt;
                                                          Money Transfer         12                0&lt;BR /&gt;
                                                          Money Validate          19                0&lt;BR /&gt;
                                                          Money Receive           12              12&lt;/P&gt;

&lt;P&gt;I'm using the below query.&lt;/P&gt;

&lt;P&gt;source=data.csv &lt;BR /&gt;
| eval status=if(isnotnull(Error), "Failed", "Success") &lt;BR /&gt;
|eval partnerids = coalesce(partnerid,PartnerId)&lt;BR /&gt;
| chart values(ApplicationName) as ApplicationName values(ServiceName) as ServiceName list(eval(if(status="Success", 1, 0))) as Succalt textess&lt;BR /&gt;
values(eval(if(status="Failed", 1, 0))) as Fail count(status) as Txns over partnerids&lt;/P&gt;

&lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Tue, 24 Nov 2015 09:55:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-i-use-stats-in-below-mentioned-Query/m-p/242884#M72263</guid>
      <dc:creator>shankaranantht</dc:creator>
      <dc:date>2015-11-24T09:55:12Z</dc:date>
    </item>
    <item>
      <title>Re: How can i use stats in below mentioned Query?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-i-use-stats-in-below-mentioned-Query/m-p/242885#M72264</link>
      <description>&lt;P&gt;shankarananth - I have verified that sundaresh query is is correct based on the sample data you provided. IE if you import that sample data set you provided as a csv, and run the exact query provided by sundaresh you will get the results you are asking for .&lt;/P&gt;

&lt;P&gt;EG: ![alt text][&lt;A href="http://imgur.com/uQEdwAK"&gt;http://imgur.com/uQEdwAK&lt;/A&gt;]&lt;/P&gt;

&lt;P&gt;If its not working for you check that the spelling (including capitals)  of field names are correct - a spelling error will give you empty fields&lt;/P&gt;</description>
      <pubDate>Tue, 24 Nov 2015 12:28:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-i-use-stats-in-below-mentioned-Query/m-p/242885#M72264</guid>
      <dc:creator>jplumsdaine22</dc:creator>
      <dc:date>2015-11-24T12:28:35Z</dc:date>
    </item>
    <item>
      <title>Re: How can i use stats in below mentioned Query?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-i-use-stats-in-below-mentioned-Query/m-p/242886#M72265</link>
      <description>&lt;P&gt;If your data is as you have specified in the question, your query will not work. The sample data does not have a "Error", partnerid or PartnerId fields. Your eval statements will fail. Now, assuming your actual data does have those fields... what result are you getting when you run your query?  &lt;/P&gt;</description>
      <pubDate>Tue, 24 Nov 2015 14:17:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-i-use-stats-in-below-mentioned-Query/m-p/242886#M72265</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2015-11-24T14:17:36Z</dc:date>
    </item>
    <item>
      <title>Re: How can i use stats in below mentioned Query?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-i-use-stats-in-below-mentioned-Query/m-p/242887#M72266</link>
      <description>&lt;P&gt;I Re-framed the query which u sent and got the result sundareshr . &lt;BR /&gt;
Thank you very much.&lt;/P&gt;</description>
      <pubDate>Tue, 24 Nov 2015 14:24:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-i-use-stats-in-below-mentioned-Query/m-p/242887#M72266</guid>
      <dc:creator>shankaranantht</dc:creator>
      <dc:date>2015-11-24T14:24:36Z</dc:date>
    </item>
  </channel>
</rss>

