<?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: help on time average calculation in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/help-on-time-average-calculation/m-p/568703#M46714</link>
    <description>&lt;P&gt;I just tried to explain that it was impossible to filter my results with | search V_Poste=* except if I use a by clause like | stats avg(diff) as diff by V_Poste...&lt;/P&gt;&lt;P&gt;But i have found the solution like this :&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| stats avg(diff) as diff by V_Poste 
| stats avg(diff)&lt;/LI-CODE&gt;</description>
    <pubDate>Tue, 28 Sep 2021 11:53:01 GMT</pubDate>
    <dc:creator>jip31</dc:creator>
    <dc:date>2021-09-28T11:53:01Z</dc:date>
    <item>
      <title>help on time average calculation</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/help-on-time-average-calculation/m-p/568643#M46699</link>
      <description>&lt;P&gt;hello&lt;/P&gt;&lt;P&gt;I use the search below in order to calculate the average of the field "diff"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=toto
| eval diff=strptime('Fin',"%d/%m/%Y %H:%M:%S")-strptime('Debut',"%d/%m/%Y %H:%M:%S") 
| eval diff=round(diff, 2)
| stats avg(diff) as diff&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am a little surprised because I have the same results if I add a | search in my search for changing the type of machine&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=toto
| eval diff=strptime('Fin',"%d/%m/%Y %H:%M:%S")-strptime('Debut',"%d/%m/%Y %H:%M:%S") 
| eval diff=round(diff, 2)
| search PPOSTE = *
| stats avg(diff) as diff&lt;/LI-CODE&gt;&lt;P&gt;OR&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=toto
| eval diff=strptime('Fin',"%d/%m/%Y %H:%M:%S")-strptime('Debut',"%d/%m/%Y %H:%M:%S") 
| eval diff=round(diff, 2)
| VPOSTE = *
| stats avg(diff) as diff&lt;/LI-CODE&gt;&lt;P&gt;Is it the correct way to do that please?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Sep 2021 05:56:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/help-on-time-average-calculation/m-p/568643#M46699</guid>
      <dc:creator>jip31</dc:creator>
      <dc:date>2021-09-28T05:56:20Z</dc:date>
    </item>
    <item>
      <title>Re: help on time average calculation</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/help-on-time-average-calculation/m-p/568646#M46700</link>
      <description>&lt;P&gt;Isn't it possible that your average diffs are simply equal in those cases?&lt;/P&gt;</description>
      <pubDate>Tue, 28 Sep 2021 06:18:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/help-on-time-average-calculation/m-p/568646#M46700</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2021-09-28T06:18:35Z</dc:date>
    </item>
    <item>
      <title>Re: help on time average calculation</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/help-on-time-average-calculation/m-p/568648#M46701</link>
      <description>&lt;P&gt;no possible...&lt;/P&gt;</description>
      <pubDate>Tue, 28 Sep 2021 06:22:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/help-on-time-average-calculation/m-p/568648#M46701</guid>
      <dc:creator>jip31</dc:creator>
      <dc:date>2021-09-28T06:22:18Z</dc:date>
    </item>
    <item>
      <title>Re: help on time average calculation</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/help-on-time-average-calculation/m-p/568649#M46702</link>
      <description>&lt;P&gt;If you search gives "strange" results, just start from the beginning and start adding components to the search after you have made sure previous one works as intended.&lt;/P&gt;&lt;P&gt;So start with your strptimes and check if they convert the time correctly, then verifh your diffs and so on.&lt;/P&gt;&lt;P&gt;At first glance the searches look pretty ok.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Sep 2021 06:26:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/help-on-time-average-calculation/m-p/568649#M46702</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2021-09-28T06:26:14Z</dc:date>
    </item>
    <item>
      <title>Re: help on time average calculation</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/help-on-time-average-calculation/m-p/568651#M46703</link>
      <description>&lt;P&gt;its what I have done but I dont understand what appen...&lt;/P&gt;&lt;P&gt;If I am doing | stats sum(diff) I have the same results for PPOSTE and VPOSTE&lt;/P&gt;&lt;P&gt;But if I am doing&amp;nbsp;| stats latest("Debut") as "Debut", latest("Fin") as "Fin", last(diff) as diff by VPOSTE, I can that my events are different and the result too!&lt;BR /&gt;| sort - diff&lt;/P&gt;</description>
      <pubDate>Tue, 28 Sep 2021 06:36:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/help-on-time-average-calculation/m-p/568651#M46703</guid>
      <dc:creator>jip31</dc:creator>
      <dc:date>2021-09-28T06:36:30Z</dc:date>
    </item>
    <item>
      <title>Re: help on time average calculation</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/help-on-time-average-calculation/m-p/568653#M46704</link>
      <description>&lt;P&gt;You're comparing single values to aggregate stats now. It's natural that they can vary.&lt;/P&gt;&lt;P&gt;Without additional info on your events all I can say is that the search seems ok.&lt;/P&gt;&lt;P&gt;Did you do a simple eval of two fields to strptimed fields and check the values if the resulting timestamps are ok?&lt;/P&gt;</description>
      <pubDate>Tue, 28 Sep 2021 06:40:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/help-on-time-average-calculation/m-p/568653#M46704</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2021-09-28T06:40:06Z</dc:date>
    </item>
    <item>
      <title>Re: help on time average calculation</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/help-on-time-average-calculation/m-p/568657#M46705</link>
      <description>&lt;P&gt;yes it is....&lt;/P&gt;&lt;P&gt;what I note is that when I use a by clause, my results are good&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| stats avg(diff) as diff by VPOSTE
| stats avg(diff) as diff by PPOSTE&lt;/LI-CODE&gt;&lt;P&gt;But if I try to filter earliest it doesn't works&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| search PPOSTE=*
| stats avg(diff) as diff&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 28 Sep 2021 07:51:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/help-on-time-average-calculation/m-p/568657#M46705</guid>
      <dc:creator>jip31</dc:creator>
      <dc:date>2021-09-28T07:51:18Z</dc:date>
    </item>
    <item>
      <title>Re: help on time average calculation</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/help-on-time-average-calculation/m-p/568661#M46706</link>
      <description>&lt;P&gt;Try to calculate sum(diff) and count(diff) and see whether they change (especially the count) if you do additional filtering with search.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Sep 2021 07:47:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/help-on-time-average-calculation/m-p/568661#M46706</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2021-09-28T07:47:00Z</dc:date>
    </item>
    <item>
      <title>Re: help on time average calculation</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/help-on-time-average-calculation/m-p/568668#M46708</link>
      <description>&lt;P&gt;if I am doing :&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=toto 
| search PPoste=* 
| eval diff=strptime('Fin chargement Profile',"%d/%m/%Y %H:%M:%S")-strptime('Debut chargement Profile',"%d/%m/%Y %H:%M:%S") 
| stats sum(diff) as sum, count(diff) as count

OR

index=toto 
| search VPoste=* 
| eval diff=strptime('Fin chargement Profile',"%d/%m/%Y %H:%M:%S")-strptime('Debut chargement Profile',"%d/%m/%Y %H:%M:%S") 
| stats sum(diff) as sum, count(diff) as count&lt;/LI-CODE&gt;&lt;P&gt;,&amp;nbsp; the results is the same&lt;/P&gt;&lt;P&gt;But if I am doing&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=toto 
| eval diff=strptime('Fin chargement Profile',"%d/%m/%Y %H:%M:%S")-strptime('Debut chargement Profile',"%d/%m/%Y %H:%M:%S") 
| stats sum(diff) as sum, count(diff) as count by PPOSTE

OR 

index=toto 
| eval diff=strptime('Fin chargement Profile',"%d/%m/%Y %H:%M:%S")-strptime('Debut chargement Profile',"%d/%m/%Y %H:%M:%S") 
| stats sum(diff) as sum, count(diff) as count by VPOSTE&lt;/LI-CODE&gt;&lt;P&gt;the result is different..&lt;/P&gt;</description>
      <pubDate>Tue, 28 Sep 2021 07:59:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/help-on-time-average-calculation/m-p/568668#M46708</guid>
      <dc:creator>jip31</dc:creator>
      <dc:date>2021-09-28T07:59:25Z</dc:date>
    </item>
    <item>
      <title>Re: help on time average calculation</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/help-on-time-average-calculation/m-p/568671#M46710</link>
      <description>&lt;P&gt;Do you understand the difference between those commands?&lt;/P&gt;&lt;P&gt;If you do&lt;/P&gt;&lt;PRE&gt;&amp;lt;&amp;lt;whatever&amp;gt;&amp;gt;&lt;BR /&gt;| search PPOSTE=*&lt;BR /&gt;| &amp;lt;&amp;lt;whatever&amp;gt;&amp;gt;&lt;/PRE&gt;&lt;P&gt;You're limiting your search only to events which have their PPOSTE field present (not null).&lt;/P&gt;&lt;P&gt;That's all. It doesn't introduce any aggregation or any other transformation of your data.&lt;/P&gt;&lt;P&gt;If you have this field present in all your data, it effectively doesn't do anything at all. Or if you select a subset of your initial events that happens to have your sought stats equal to that of a whole population, you won't see any differences.&lt;/P&gt;&lt;P&gt;And you showed yourself that filtering your events by adding | search in the middle doesn't change the count of your events.&lt;/P&gt;&lt;P&gt;But if you do&lt;/P&gt;&lt;PRE&gt;&amp;lt;&amp;lt;whatever&amp;gt;&amp;gt;&lt;BR /&gt;| stats agg-stat(field) by PPOSTE&lt;/PRE&gt;&lt;P&gt;you're calculating separate stats value for each subset of your initial data - one per each value of PPOSTE field. So instead of a single value for your filtered subset of data you're getting as many resulting stats values as your PPOSTE field has distinct values.&lt;/P&gt;&lt;P&gt;You're doing two completely different things so it's only natural that they give other results.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Sep 2021 08:13:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/help-on-time-average-calculation/m-p/568671#M46710</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2021-09-28T08:13:37Z</dc:date>
    </item>
    <item>
      <title>Re: help on time average calculation</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/help-on-time-average-calculation/m-p/568673#M46711</link>
      <description>&lt;P&gt;yes of course I understand the difference&lt;/P&gt;&lt;P&gt;But my need is to calculate an average in a single panel from the VPOSTE and the PPOSTE field&lt;/P&gt;&lt;P&gt;So i need to filter the events before my stats instead using a by clause&lt;/P&gt;&lt;P&gt;So what I dont understand is that when I use the search below alone, it works and it filter the events correcty&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=toto
| search VPoste=*
| table VPoste&lt;/LI-CODE&gt;&lt;P&gt;But when I use it with the diff calculation it doesnt works&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can see the XML&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;panel&amp;gt;
      &amp;lt;single&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;index=virtuos_pr_metrics_citrix_connexion sourcetype=bp | search P_Poste=*
| eval diff=strptime('Fin chargement Profile',"%d/%m/%Y %H:%M:%S")-strptime('Debut chargement Profile',"%d/%m/%Y %H:%M:%S") 
| stats avg(diff) as diff&amp;lt;/query&amp;gt;
          &amp;lt;earliest&amp;gt;-24h@h&amp;lt;/earliest&amp;gt;
          &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
        &amp;lt;/search&amp;gt;
        &amp;lt;option name="drilldown"&amp;gt;none&amp;lt;/option&amp;gt;
        &amp;lt;option name="numberPrecision"&amp;gt;0.00&amp;lt;/option&amp;gt;
        &amp;lt;option name="rangeColors"&amp;gt;["0x53a051","0x0877a6","0xf8be34","0xf1813f","0xdc4e41"]&amp;lt;/option&amp;gt;
        &amp;lt;option name="refresh.display"&amp;gt;progressbar&amp;lt;/option&amp;gt;
        &amp;lt;option name="unit"&amp;gt;sec&amp;lt;/option&amp;gt;
      &amp;lt;/single&amp;gt;
    &amp;lt;/panel&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Sep 2021 08:26:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/help-on-time-average-calculation/m-p/568673#M46711</guid>
      <dc:creator>jip31</dc:creator>
      <dc:date>2021-09-28T08:26:03Z</dc:date>
    </item>
    <item>
      <title>Re: help on time average calculation</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/help-on-time-average-calculation/m-p/568676#M46712</link>
      <description>&lt;P&gt;Sorry mate, but I fail to understand what you're trying to do.&lt;/P&gt;&lt;P&gt;You have some events of which all seem to have fields PPOSTE and VPOSTE (at least that's how it looks from your earlier posts). So every aggregate stat, regardless of whether you do a | search PPOSTE=* or | search VPOSTE=* will result in the same values since you're doing aggregate stats on the whole set.&lt;/P&gt;&lt;P&gt;So if you want to do something else, please explain &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Maybe show some excerpt of your data and desired result.&lt;/P&gt;&lt;P&gt;Because so far I simply don't understand what you're trying to achieve.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Sep 2021 08:47:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/help-on-time-average-calculation/m-p/568676#M46712</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2021-09-28T08:47:52Z</dc:date>
    </item>
    <item>
      <title>Re: help on time average calculation</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/help-on-time-average-calculation/m-p/568703#M46714</link>
      <description>&lt;P&gt;I just tried to explain that it was impossible to filter my results with | search V_Poste=* except if I use a by clause like | stats avg(diff) as diff by V_Poste...&lt;/P&gt;&lt;P&gt;But i have found the solution like this :&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| stats avg(diff) as diff by V_Poste 
| stats avg(diff)&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 28 Sep 2021 11:53:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/help-on-time-average-calculation/m-p/568703#M46714</guid>
      <dc:creator>jip31</dc:creator>
      <dc:date>2021-09-28T11:53:01Z</dc:date>
    </item>
    <item>
      <title>Re: help on time average calculation</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/help-on-time-average-calculation/m-p/568720#M46718</link>
      <description>&lt;P&gt;avg from avg is kinda strange approach.&lt;/P&gt;&lt;P&gt;Are you sure that's what you need?&lt;/P&gt;&lt;P&gt;And indeed you don't seem to be filtering anything since apparently V_Poste (last time it was called VPOSTE ;-)) seems to be omnipresent so unless you filter by particular values of this field, you'll get your whole set of data back.&lt;/P&gt;&lt;P&gt;I still think it might be quite simple to do what you need but I don't understand what it is &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I don't know your data, I don't know the needed result. I just see your tries at searching.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Sep 2021 13:02:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/help-on-time-average-calculation/m-p/568720#M46718</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2021-09-28T13:02:03Z</dc:date>
    </item>
  </channel>
</rss>

