<?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: Using list in query fails to return records in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Using-list-in-query-fails-to-return-records/m-p/358450#M105967</link>
    <description>&lt;P&gt;It didn't work. So my query is &lt;BR /&gt;
    | dedup Question&lt;BR /&gt;
    | stats list(Question) as questions by Answer, Market&lt;BR /&gt;
    | eval question = mvindex(questions, 1) &lt;BR /&gt;
    | where Question = question &lt;BR /&gt;
    | chart count as Count over Answer by Market&lt;/P&gt;

&lt;P&gt;I am trying to have 1 pie chart for 1 question&lt;BR /&gt;
So i need to filter by the questions without hard coding the question in query.&lt;BR /&gt;
It displayed all the events like before and no charts or statistics.&lt;/P&gt;</description>
    <pubDate>Thu, 26 Apr 2018 15:58:12 GMT</pubDate>
    <dc:creator>nirmalya2006</dc:creator>
    <dc:date>2018-04-26T15:58:12Z</dc:date>
    <item>
      <title>Using list in query fails to return records</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-list-in-query-fails-to-return-records/m-p/358447#M105964</link>
      <description>&lt;P&gt;Hi All&lt;/P&gt;

&lt;P&gt;I have data in the below fomat&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Market=UK, Question=Where do you live, Answer=London 
Market=USA, Question=Where do you live, Answer=New York 
Market=UK, Question=What is you pet, Answer=dog 
Market=USA, Question=What is you pet, Answer=cat
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;... and so on&lt;/P&gt;

&lt;P&gt;The problem is the question is not exhaustive and it can keep changing. So I cannot hard code a question in the query.&lt;BR /&gt;
I am trying to create pie charts for each question.&lt;BR /&gt;
I have written a query to get the count of answers based on market for a specific question from a list of question.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=index1 sourcetype=app_logs 
| dedup Question 
| stats list(Question) as questions  
| eval question=mvindex(questions, 1) 
| where Question = question 
| chart count as Count over Answer by Market
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The problem is, when I include the 3rd line (| stats list(Question) as questions ) the query returns all the events and not the statistics&lt;BR /&gt;
So I am not able to get any records for charting.&lt;/P&gt;

&lt;P&gt;I am sure there is something wrong with the query but not able to figure it out.&lt;BR /&gt;
Can someone help me please.&lt;/P&gt;</description>
      <pubDate>Tue, 24 Apr 2018 13:36:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-list-in-query-fails-to-return-records/m-p/358447#M105964</guid>
      <dc:creator>nirmalya2006</dc:creator>
      <dc:date>2018-04-24T13:36:57Z</dc:date>
    </item>
    <item>
      <title>Re: Using list in query fails to return records</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-list-in-query-fails-to-return-records/m-p/358448#M105965</link>
      <description>&lt;P&gt;Can you try something: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| stats count(Answer) by Question, Market
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 24 Apr 2018 14:02:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-list-in-query-fails-to-return-records/m-p/358448#M105965</guid>
      <dc:creator>p_gurav</dc:creator>
      <dc:date>2018-04-24T14:02:30Z</dc:date>
    </item>
    <item>
      <title>Re: Using list in query fails to return records</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-list-in-query-fails-to-return-records/m-p/358449#M105966</link>
      <description>&lt;P&gt;Hi ,&lt;/P&gt;

&lt;P&gt;You should add Answer and Market into the stats query.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;...| stats list(Question) as questions by Answer,Market|....
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Hope helps&lt;/P&gt;</description>
      <pubDate>Tue, 24 Apr 2018 14:06:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-list-in-query-fails-to-return-records/m-p/358449#M105966</guid>
      <dc:creator>gyarici</dc:creator>
      <dc:date>2018-04-24T14:06:13Z</dc:date>
    </item>
    <item>
      <title>Re: Using list in query fails to return records</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-list-in-query-fails-to-return-records/m-p/358450#M105967</link>
      <description>&lt;P&gt;It didn't work. So my query is &lt;BR /&gt;
    | dedup Question&lt;BR /&gt;
    | stats list(Question) as questions by Answer, Market&lt;BR /&gt;
    | eval question = mvindex(questions, 1) &lt;BR /&gt;
    | where Question = question &lt;BR /&gt;
    | chart count as Count over Answer by Market&lt;/P&gt;

&lt;P&gt;I am trying to have 1 pie chart for 1 question&lt;BR /&gt;
So i need to filter by the questions without hard coding the question in query.&lt;BR /&gt;
It displayed all the events like before and no charts or statistics.&lt;/P&gt;</description>
      <pubDate>Thu, 26 Apr 2018 15:58:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-list-in-query-fails-to-return-records/m-p/358450#M105967</guid>
      <dc:creator>nirmalya2006</dc:creator>
      <dc:date>2018-04-26T15:58:12Z</dc:date>
    </item>
    <item>
      <title>Re: Using list in query fails to return records</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-list-in-query-fails-to-return-records/m-p/358451#M105968</link>
      <description>&lt;P&gt;That is not something I am trying. I wanted to have 1 pie chart for each question.&lt;BR /&gt;
So i need to filter by the questions without hard coding the question in query.&lt;/P&gt;</description>
      <pubDate>Thu, 26 Apr 2018 16:01:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-list-in-query-fails-to-return-records/m-p/358451#M105968</guid>
      <dc:creator>nirmalya2006</dc:creator>
      <dc:date>2018-04-26T16:01:28Z</dc:date>
    </item>
    <item>
      <title>Re: Using list in query fails to return records</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-list-in-query-fails-to-return-records/m-p/358452#M105969</link>
      <description>&lt;P&gt;What's you pie chart should show? Are you trying to create a pie chart showing how many time a question is being answered? If yes, try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=index1 sourcetype=app_logs 
 | stats count by Question
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If you're looking to count how many markets that questions is asked, try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=index1 sourcetype=app_logs 
 | stats dc(Market) as Markets by Question
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 26 Apr 2018 16:36:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-list-in-query-fails-to-return-records/m-p/358452#M105969</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2018-04-26T16:36:37Z</dc:date>
    </item>
    <item>
      <title>Re: Using list in query fails to return records</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-list-in-query-fails-to-return-records/m-p/358453#M105970</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;You can try something like this :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=index1 sourcetype=app_logs 
| stats count(Answer) BY Question,Answer
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;After that, choose the Pie Chart Visualisation and activate Trellis.&lt;BR /&gt;
So check  &lt;STRONG&gt;Use Trellis Layout&lt;/STRONG&gt; and select &lt;STRONG&gt;Split by Question&lt;/STRONG&gt;&lt;BR /&gt;
You will have have 1 Pie chart by question with it answers without hard coding any questions.&lt;/P&gt;

&lt;P&gt;Tell me if it works &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Kail&lt;/P&gt;</description>
      <pubDate>Thu, 26 Apr 2018 21:08:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-list-in-query-fails-to-return-records/m-p/358453#M105970</guid>
      <dc:creator>KailA</dc:creator>
      <dc:date>2018-04-26T21:08:11Z</dc:date>
    </item>
    <item>
      <title>Re: Using list in query fails to return records</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-list-in-query-fails-to-return-records/m-p/358454#M105971</link>
      <description>&lt;P&gt;Fabulous !! Thanks a ton. Its exactly what I was trying to do manually.&lt;/P&gt;</description>
      <pubDate>Fri, 27 Apr 2018 09:28:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-list-in-query-fails-to-return-records/m-p/358454#M105971</guid>
      <dc:creator>nirmalya2006</dc:creator>
      <dc:date>2018-04-27T09:28:33Z</dc:date>
    </item>
    <item>
      <title>Re: Using list in query fails to return records</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-list-in-query-fails-to-return-records/m-p/358455#M105972</link>
      <description>&lt;P&gt;Glad to help !&lt;/P&gt;</description>
      <pubDate>Fri, 27 Apr 2018 12:48:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-list-in-query-fails-to-return-records/m-p/358455#M105972</guid>
      <dc:creator>KailA</dc:creator>
      <dc:date>2018-04-27T12:48:03Z</dc:date>
    </item>
  </channel>
</rss>

