<?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 distinct count and eval in timechart (area chart) in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/Using-distinct-count-and-eval-in-timechart-area-chart/m-p/292388#M18553</link>
    <description>&lt;P&gt;The last calculation, and the results on it, make no sense to me.  &lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;eval(page_logging=6)&lt;/CODE&gt; has three possible values for any given record {null, true, false}.  Null is not a value that &lt;CODE&gt;dc&lt;/CODE&gt; counts, so for that formula, &lt;CODE&gt;dc&lt;/CODE&gt; can only give 0, 1 or 2, and I'd expect it to vary between 1 and 2, mostly 2, if the field &lt;CODE&gt;page_logging&lt;/CODE&gt; is usually present and if people commonly drop out and also people commonly finish.  So, I'd go back and check your assumptions based on common sense expectations for the data.&lt;/P&gt;

&lt;P&gt;You are really looking, I believe, for &lt;CODE&gt;dc(user_id)&lt;/CODE&gt; where &lt;CODE&gt;page_logging=6&lt;/CODE&gt;.  I think my preference, as the most straightforward approach, would be preprocessing, but let me see if I can tease this out to code it your way...&lt;/P&gt;

&lt;P&gt;It will be something like...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; dc(eval(if(page_logging=6,user_id,null()))) as formManagerUsers
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 17 Aug 2017 15:38:34 GMT</pubDate>
    <dc:creator>DalJeanis</dc:creator>
    <dc:date>2017-08-17T15:38:34Z</dc:date>
    <item>
      <title>Using distinct count and eval in timechart (area chart)</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Using-distinct-count-and-eval-in-timechart-area-chart/m-p/292387#M18552</link>
      <description>&lt;P&gt;To begin with, I'm a beginner in world of Splunk. I'm trying to create an area chart where I could track how many users are using the application, how many have completed the application (reached page 6) and how many users are using formManager. In query I've stated that if the user reaches page six, which is the last page of the application, the form is saved to formManager thus adding the user as formManager user. I'm using all three counts successfully as a single value panel in my dashboard but I would like to visualize it in a graph.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;dc(user_id) as applicationUsers&lt;/STRONG&gt; and &lt;STRONG&gt;count(eval(page_logging=6)) as completedForms&lt;/STRONG&gt; works like a charm but &lt;STRONG&gt;dc(eval(page_logging=6)) as formManagerUsers&lt;/STRONG&gt; returns only zero or one per hour in my area chart.&lt;/P&gt;

&lt;P&gt;I'm using following query as single value to track formManager users:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=prod sourcetype=application page_logging=6 | stats dc(user_id)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;Here's my query for area chart:&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=prod sourcetype=application | timechart span=1h dc(user_id) as applicationUsers, count(eval(page_logging=6)) as completedForms, dc(eval(page_logging=6)) as formManagerUsers
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 17 Aug 2017 07:12:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Using-distinct-count-and-eval-in-timechart-area-chart/m-p/292387#M18552</guid>
      <dc:creator>Jurala</dc:creator>
      <dc:date>2017-08-17T07:12:08Z</dc:date>
    </item>
    <item>
      <title>Re: Using distinct count and eval in timechart (area chart)</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Using-distinct-count-and-eval-in-timechart-area-chart/m-p/292388#M18553</link>
      <description>&lt;P&gt;The last calculation, and the results on it, make no sense to me.  &lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;eval(page_logging=6)&lt;/CODE&gt; has three possible values for any given record {null, true, false}.  Null is not a value that &lt;CODE&gt;dc&lt;/CODE&gt; counts, so for that formula, &lt;CODE&gt;dc&lt;/CODE&gt; can only give 0, 1 or 2, and I'd expect it to vary between 1 and 2, mostly 2, if the field &lt;CODE&gt;page_logging&lt;/CODE&gt; is usually present and if people commonly drop out and also people commonly finish.  So, I'd go back and check your assumptions based on common sense expectations for the data.&lt;/P&gt;

&lt;P&gt;You are really looking, I believe, for &lt;CODE&gt;dc(user_id)&lt;/CODE&gt; where &lt;CODE&gt;page_logging=6&lt;/CODE&gt;.  I think my preference, as the most straightforward approach, would be preprocessing, but let me see if I can tease this out to code it your way...&lt;/P&gt;

&lt;P&gt;It will be something like...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; dc(eval(if(page_logging=6,user_id,null()))) as formManagerUsers
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 17 Aug 2017 15:38:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Using-distinct-count-and-eval-in-timechart-area-chart/m-p/292388#M18553</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-08-17T15:38:34Z</dc:date>
    </item>
    <item>
      <title>Re: Using distinct count and eval in timechart (area chart)</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Using-distinct-count-and-eval-in-timechart-area-chart/m-p/292389#M18554</link>
      <description>&lt;P&gt;Thanks! Works as expected.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Aug 2017 05:58:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Using-distinct-count-and-eval-in-timechart-area-chart/m-p/292389#M18554</guid>
      <dc:creator>Jurala</dc:creator>
      <dc:date>2017-08-22T05:58:56Z</dc:date>
    </item>
  </channel>
</rss>

