<?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 How to sum timechart results from multiple search queries? in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-sum-timechart-results-from-multiple-search-queries/m-p/601296#M49380</link>
    <description>&lt;P&gt;Hi, I have multiple timecharts which have similar search queries, sharing the same index, the only difference is that they are from different metric names, ie&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;| mstats max(my_Var) AS my_Var where index=* AND "internal_name"="A1"
...
| timechart span=1w sum(Var) AS output&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;| mstats max(my_Var) AS my_Var where index=* AND "internal_name"="A2"
...
| timechart span=1w sum(Var) AS output&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;.. and so on.&lt;/P&gt;&lt;P&gt;I would like to have a panel where the various "output" are summed into a combined timechart.&lt;BR /&gt;I have seen some similar solutions involving tokens, but I am unfamiliar with how they work, so I hope that someone can walk me through what to do, or any other solutions will be great too. Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 10 Jun 2022 05:26:13 GMT</pubDate>
    <dc:creator>dzyfer</dc:creator>
    <dc:date>2022-06-10T05:26:13Z</dc:date>
    <item>
      <title>How to sum timechart results from multiple search queries?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-sum-timechart-results-from-multiple-search-queries/m-p/601296#M49380</link>
      <description>&lt;P&gt;Hi, I have multiple timecharts which have similar search queries, sharing the same index, the only difference is that they are from different metric names, ie&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;| mstats max(my_Var) AS my_Var where index=* AND "internal_name"="A1"
...
| timechart span=1w sum(Var) AS output&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;| mstats max(my_Var) AS my_Var where index=* AND "internal_name"="A2"
...
| timechart span=1w sum(Var) AS output&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;.. and so on.&lt;/P&gt;&lt;P&gt;I would like to have a panel where the various "output" are summed into a combined timechart.&lt;BR /&gt;I have seen some similar solutions involving tokens, but I am unfamiliar with how they work, so I hope that someone can walk me through what to do, or any other solutions will be great too. Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jun 2022 05:26:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-sum-timechart-results-from-multiple-search-queries/m-p/601296#M49380</guid>
      <dc:creator>dzyfer</dc:creator>
      <dc:date>2022-06-10T05:26:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to sum timechart results from multiple search queries?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-sum-timechart-results-from-multiple-search-queries/m-p/601301#M49381</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/243599"&gt;@dzyfer&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;did you tried something like this?&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| mstats max(my_Var) AS my_Var where index=* AND (internal_name IN ("A1","A2")
| timechart span=1w sum(Var) AS output&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jun 2022 06:17:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-sum-timechart-results-from-multiple-search-queries/m-p/601301#M49381</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2022-06-10T06:17:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to sum timechart results from multiple search queries?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-sum-timechart-results-from-multiple-search-queries/m-p/601311#M49382</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/161352"&gt;@gcusello&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;thanks for the prompt reply, however, using the IN function in the first line leads to the search summing up the results at the beginning, but my search actually consists of intermediate calculations before arriving at the "Var" variable, and this method causes the final summation to be inaccurate. As such, I'm wondering if there is a way to sum up the final results only.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jun 2022 06:58:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-sum-timechart-results-from-multiple-search-queries/m-p/601311#M49382</guid>
      <dc:creator>dzyfer</dc:creator>
      <dc:date>2022-06-10T06:58:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to sum timechart results from multiple search queries?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-sum-timechart-results-from-multiple-search-queries/m-p/601313#M49383</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/243599"&gt;@dzyfer&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;I don't think that the inaccurate summarization is fo the global data because I didn't see any where condition in your searches, anyway, you can make the time chart summarization in two steps:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| mstats max(my_Var) AS my_Var where index=* AND (internal_name IN ("A1","A2")
| bin span=1w _time
| stats sum(eval(if(internal_name="A1",Var,0) AS output_A1 sum(eval(if(internal_name="A2",Var,0) AS output_A2 BY _time
| eval output=output_A1+output_A2&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jun 2022 07:26:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-sum-timechart-results-from-multiple-search-queries/m-p/601313#M49383</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2022-06-10T07:26:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to sum timechart results from multiple search queries?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-sum-timechart-results-from-multiple-search-queries/m-p/601314#M49384</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/161352"&gt;@gcusello&lt;/a&gt;&amp;nbsp;,&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Apologies, in an attempt to anonymize my search earlier I have made some errors, which have made it seem confusing, so this is the corrected code with other variable so that maybe it would be easier to understand my dilemma.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| mstats span=1m earliest(monitor) AS first latest(monitor) AS last max(monitor) AS max WHERE index=organizationmetric AND internal_name="SR01" 
| autoregress last AS lastlast 
| eval diff = if(first = lastlast, 0,if(first-lastlast&amp;lt;0,0,first-lastlast))
| eval divmaxlast = round(max-last,0)
| eval meter = round(if(max=last,last-first,if(last&amp;lt;max,if(divmaxlast&amp;lt;2,last-first,max-first+last),max-first+last))) + diff
| eval date=strftime(_time,"%Y-%m-%V")
| timechart span=1w sum(meter) AS output&lt;/LI-CODE&gt;&lt;P&gt;the other metric names are "SR02" "SR03" "SR04"&lt;BR /&gt;&lt;BR /&gt;Thanks and sorry again for the confusion&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jun 2022 07:52:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-sum-timechart-results-from-multiple-search-queries/m-p/601314#M49384</guid>
      <dc:creator>dzyfer</dc:creator>
      <dc:date>2022-06-10T07:52:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to sum timechart results from multiple search queries?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-sum-timechart-results-from-multiple-search-queries/m-p/601315#M49385</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/243599"&gt;@dzyfer&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Ok, in this case the easiest approach is schedule all your original searches (frequency depends on how many data you receive) and saving results in a summary index, then you can use this Summary index for your global timecharting.&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jun 2022 08:07:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-sum-timechart-results-from-multiple-search-queries/m-p/601315#M49385</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2022-06-10T08:07:47Z</dc:date>
    </item>
  </channel>
</rss>

