<?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: Return items not present in a subsearch in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Why-Return-items-not-present-in-a-subsearch/m-p/639596#M109213</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/255759"&gt;@psimoes&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;as&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/158935"&gt;@yeahnah&lt;/a&gt;&amp;nbsp;said, this is an incorrect way to use subsearches and anyway, you don't need a subsearch for your purpose.&lt;/P&gt;&lt;P&gt;Please try something like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=A (action=view OR action=purchase)
| stats dc(action) AS action_count values(action) AS action BY user 
| where action_count=1 AND action=view&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
    <pubDate>Wed, 12 Apr 2023 06:26:30 GMT</pubDate>
    <dc:creator>gcusello</dc:creator>
    <dc:date>2023-04-12T06:26:30Z</dc:date>
    <item>
      <title>Why Return items not present in a subsearch?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Why-Return-items-not-present-in-a-subsearch/m-p/639567#M109206</link>
      <description>&lt;P&gt;Given the simple scenario:&lt;/P&gt;
&lt;P&gt;I have users in a platform that have actions, I want to return all the users that haven't performed a specific action. For example, I want to return all users that have been doing the action "View", but haven't performed any action "Purchase". The index would be the same.&lt;/P&gt;
&lt;P&gt;Pseudo query:&lt;/P&gt;
&lt;P&gt;index=A action=view [ search index=A action=purchase | stats count by user ] | where count by user = 0&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any idea how could I write such query?&lt;/P&gt;</description>
      <pubDate>Wed, 12 Apr 2023 16:28:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Why-Return-items-not-present-in-a-subsearch/m-p/639567#M109206</guid>
      <dc:creator>psimoes</dc:creator>
      <dc:date>2023-04-12T16:28:20Z</dc:date>
    </item>
    <item>
      <title>Re: Return items not present in a subsearch</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Why-Return-items-not-present-in-a-subsearch/m-p/639589#M109212</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/255759"&gt;@psimoes&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;No need for a subsearch to do this - avoid subsearches where possible as less efficient.&lt;BR /&gt;&lt;BR /&gt;Try this...&lt;/P&gt;&lt;PRE&gt;index=A action=view OR action=purchase&lt;BR /&gt;| stats count values(action) AS actions BY user&lt;BR /&gt;| eval purchase_made=if(isnotnull(mvfilter(match(actions, "purchase"))), "yes", "no")&lt;BR /&gt;| where purchase_made="no"&lt;/PRE&gt;&lt;P&gt;The &lt;EM&gt;actions&lt;/EM&gt; field is a multivalue field and the &lt;EM&gt;if&lt;/EM&gt; statement tests whether this field contains the purchase value or not, before the where filter is applied.&lt;BR /&gt;&lt;BR /&gt;Hope it helps&lt;/P&gt;</description>
      <pubDate>Wed, 12 Apr 2023 01:36:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Why-Return-items-not-present-in-a-subsearch/m-p/639589#M109212</guid>
      <dc:creator>yeahnah</dc:creator>
      <dc:date>2023-04-12T01:36:36Z</dc:date>
    </item>
    <item>
      <title>Re: Return items not present in a subsearch</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Why-Return-items-not-present-in-a-subsearch/m-p/639596#M109213</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/255759"&gt;@psimoes&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;as&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/158935"&gt;@yeahnah&lt;/a&gt;&amp;nbsp;said, this is an incorrect way to use subsearches and anyway, you don't need a subsearch for your purpose.&lt;/P&gt;&lt;P&gt;Please try something like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=A (action=view OR action=purchase)
| stats dc(action) AS action_count values(action) AS action BY user 
| where action_count=1 AND action=view&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Wed, 12 Apr 2023 06:26:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Why-Return-items-not-present-in-a-subsearch/m-p/639596#M109213</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2023-04-12T06:26:30Z</dc:date>
    </item>
    <item>
      <title>Re: Return items not present in a subsearch</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Why-Return-items-not-present-in-a-subsearch/m-p/639623#M109214</link>
      <description>&lt;P&gt;hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/255759"&gt;@psimoes&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;&lt;BR /&gt;As&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/158935"&gt;@yeahnah&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/161352"&gt;@gcusello&lt;/a&gt;&amp;nbsp;mentioned, you don't need a sub-search for this unless your action=purchage events are in a different index/sourcetype.&lt;BR /&gt;&lt;BR /&gt;Try this.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults 
| eval _raw="user,action
A,view
B,view
C,view
C,purchase
D,purchase" 
| multikv forceheader=1 
| fields - _raw, linecount 
| eventstats count(eval(action="view")) as view_count, count(eval(action="purchase")) as purchase_count by user 
| where purchase_count=0&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Apr 2023 10:32:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Why-Return-items-not-present-in-a-subsearch/m-p/639623#M109214</guid>
      <dc:creator>manjunathmeti</dc:creator>
      <dc:date>2023-04-12T10:32:56Z</dc:date>
    </item>
    <item>
      <title>Re: Why Return items not present in a subsearch?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Why-Return-items-not-present-in-a-subsearch/m-p/639825#M109241</link>
      <description>&lt;P&gt;Like this:&lt;BR /&gt;| makeresults&lt;BR /&gt;| eval _raw="&lt;BR /&gt;user action&lt;BR /&gt;A view&lt;BR /&gt;A purchase&lt;BR /&gt;B view&lt;BR /&gt;C purchase"&lt;BR /&gt;| multikv forceheader=1&lt;BR /&gt;| stats count(eval(action="view")) AS views count(eval(action="purchase")) AS purchases BY user&lt;BR /&gt;| where views&amp;gt;0 AND purchases==0&lt;BR /&gt;&lt;BR /&gt;So like this:&lt;BR /&gt;&lt;SPAN&gt;index="A" AND (action="view" OR action="purchase")&lt;BR /&gt;| stats count(eval(action="view")) AS views count(eval(action="purchase")) AS purchases BY user&lt;BR /&gt;| where views&amp;gt;0 AND purchases==0&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Apr 2023 15:59:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Why-Return-items-not-present-in-a-subsearch/m-p/639825#M109241</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2023-04-13T15:59:55Z</dc:date>
    </item>
  </channel>
</rss>

