<?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 to use AND clause between different count from Mstats queries? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-AND-clause-between-different-count-from-Mstats/m-p/608205#M211480</link>
    <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/15147"&gt;@somesoni2&lt;/a&gt;&amp;nbsp;Below is the result without &lt;STRONG&gt;WHERE&lt;/STRONG&gt; clause, If I apply count1&amp;gt;0 and count2&amp;gt;0 condition it is getting applied on each individual row but I'm looking for AND operator between these 2 queries. if count from metric1 query AND count 2 from metric2 query is &amp;gt;0 then show results.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2022-08-04 at 8.40.48 AM.png" style="width: 999px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/20848i5BEB44B5D3B17664/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2022-08-04 at 8.40.48 AM.png" alt="Screenshot 2022-08-04 at 8.40.48 AM.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 04 Aug 2022 03:23:57 GMT</pubDate>
    <dc:creator>pancham</dc:creator>
    <dc:date>2022-08-04T03:23:57Z</dc:date>
    <item>
      <title>How to use AND clause between different count from Mstats queries?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-AND-clause-between-different-count-from-Mstats/m-p/608162#M211463</link>
      <description>&lt;P&gt;query 1&lt;BR /&gt;|mstats count(_value) as count1 WHERE metric_name="*metric1*" AND metric_type=c AND status="success" by metric_name,env,status| where count1&amp;gt;0&lt;/P&gt;
&lt;P&gt;query 2&lt;/P&gt;
&lt;P&gt;|mstats count(_value) as count2 WHERE metric_name="*metric2*" AND metric_type=c AND status="success" by metric_name,env,status| where count2=0&lt;/P&gt;
&lt;P&gt;These queries are working fine individually I need combine show results only if&amp;nbsp;&lt;/P&gt;
&lt;P&gt;count1&amp;gt;0 and count2=0&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Aug 2022 18:49:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-AND-clause-between-different-count-from-Mstats/m-p/608162#M211463</guid>
      <dc:creator>pancham</dc:creator>
      <dc:date>2022-08-03T18:49:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to use AND clause between different count from Mstats queries?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-AND-clause-between-different-count-from-Mstats/m-p/608184#M211474</link>
      <description>&lt;P&gt;Try like this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;|mstats count(_value) as count1 WHERE metric_name="*metric1*" AND metric_type=c AND status="success" by metric_name,env,status
| append [|mstats count(_value) as count2 WHERE metric_name="*metric2*" AND metric_type=c AND status="success" by metric_name,env,status]
| stats values(count1) as count1 values(count2) as count2 by by metric_name,env,status
| where count1&amp;gt;0 AND count2&amp;gt;0&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 03 Aug 2022 20:35:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-AND-clause-between-different-count-from-Mstats/m-p/608184#M211474</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2022-08-03T20:35:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to use AND clause between different count from Mstats queries?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-AND-clause-between-different-count-from-Mstats/m-p/608205#M211480</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/15147"&gt;@somesoni2&lt;/a&gt;&amp;nbsp;Below is the result without &lt;STRONG&gt;WHERE&lt;/STRONG&gt; clause, If I apply count1&amp;gt;0 and count2&amp;gt;0 condition it is getting applied on each individual row but I'm looking for AND operator between these 2 queries. if count from metric1 query AND count 2 from metric2 query is &amp;gt;0 then show results.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2022-08-04 at 8.40.48 AM.png" style="width: 999px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/20848i5BEB44B5D3B17664/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2022-08-04 at 8.40.48 AM.png" alt="Screenshot 2022-08-04 at 8.40.48 AM.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Aug 2022 03:23:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-AND-clause-between-different-count-from-Mstats/m-p/608205#M211480</guid>
      <dc:creator>pancham</dc:creator>
      <dc:date>2022-08-04T03:23:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to use AND clause between different count from Mstats queries?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-AND-clause-between-different-count-from-Mstats/m-p/608274#M211497</link>
      <description>&lt;P&gt;Give this a try&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;|mstats count(_value) as count WHERE (metric_name="*metric1*" OR metric_name="*metric2*") AND metric_type=c AND status="success" by metric_name,env,status
| eval temp=env."#".status 
| eval metric_name=if(match(metric_name,"metric1"),"metric1","metric2")
| chart values(count) over temp by metric_name
| WHERE metric1&amp;gt;0 AND metric&amp;gt;0&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;OR&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;|mstats count(_value) as count1 WHERE metric_name="*metric1*" AND metric_type=c AND status="success" by metric_name,env,status
| appendcols [|mstats count(_value) as count2 WHERE metric_name="*metric2*" AND metric_type=c AND status="success" by metric_name,env,status]
| where count1&amp;gt;0 AND count2&amp;gt;0&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 04 Aug 2022 13:05:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-AND-clause-between-different-count-from-Mstats/m-p/608274#M211497</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2022-08-04T13:05:01Z</dc:date>
    </item>
  </channel>
</rss>

