<?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: Overlay Two Graphs Together in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/Overlay-Two-Graphs-Together/m-p/305492#M19451</link>
    <description>&lt;P&gt;The simplest thing to do is to append them both together and run them through &lt;CODE&gt;timechart&lt;/CODE&gt;.&lt;/P&gt;</description>
    <pubDate>Thu, 13 Jul 2017 00:55:56 GMT</pubDate>
    <dc:creator>woodcock</dc:creator>
    <dc:date>2017-07-13T00:55:56Z</dc:date>
    <item>
      <title>Overlay Two Graphs Together</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Overlay-Two-Graphs-Together/m-p/305490#M19449</link>
      <description>&lt;P&gt;I have two graphs in a Splunk dashboard that I want to combine/overlay into one, both concerning data from a survey.&lt;/P&gt;

&lt;P&gt;The first shows the total number of survey responses: &lt;A href="http://imgur.com/a/Q3ebx"&gt;http://imgur.com/a/Q3ebx&lt;/A&gt;&lt;BR /&gt;
Here is the search query:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=webex_sentiment | eval surveyDate=strptime(Started,"%m/%d/%Y %H:%M") | eval YearWeek=strftime(surveyDate,"%Y-%U") | search YearWeek!="2016-00" | chart  count(Rating) as NumberRatings by YearWeek | search YearWeek &amp;gt; 2016-12
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The second shows the number of survey responses that contained negative sentiment, along with a moving average: &lt;A href="http://imgur.com/a/H2ryv"&gt;http://imgur.com/a/H2ryv&lt;/A&gt;&lt;BR /&gt;
Here is the search query: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=webex_sentiment | eval surveyDate=strptime(Started,"%m/%d/%Y %H:%M") |  eval YearWeek=strftime(surveyDate,"%Y-%U") |search YearWeek!="2016-00"| stats count(Rating) as NumberRatings by YearWeek Rating | eventstats sum(NumberRatings) as TotalRatings by YearWeek | eval PercentageRatings=round(NumberRatings/TotalRatings,3) | where Rating=1 OR Rating=2 | stats sum(PercentageRatings) as NegativeSentiment by YearWeek | trendline sma3(NegativeSentiment) AS MovingAverage(NegativeSentiment) 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I want to display both of these lines graphs in a single chart. Please advise.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jul 2017 19:00:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Overlay-Two-Graphs-Together/m-p/305490#M19449</guid>
      <dc:creator>mhtedford</dc:creator>
      <dc:date>2017-07-12T19:00:34Z</dc:date>
    </item>
    <item>
      <title>Re: Overlay Two Graphs Together</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Overlay-Two-Graphs-Together/m-p/305491#M19450</link>
      <description>&lt;P&gt;I'll give 100 karma to the right answer &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jul 2017 19:32:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Overlay-Two-Graphs-Together/m-p/305491#M19450</guid>
      <dc:creator>mhtedford</dc:creator>
      <dc:date>2017-07-12T19:32:33Z</dc:date>
    </item>
    <item>
      <title>Re: Overlay Two Graphs Together</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Overlay-Two-Graphs-Together/m-p/305492#M19451</link>
      <description>&lt;P&gt;The simplest thing to do is to append them both together and run them through &lt;CODE&gt;timechart&lt;/CODE&gt;.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jul 2017 00:55:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Overlay-Two-Graphs-Together/m-p/305492#M19451</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-07-13T00:55:56Z</dc:date>
    </item>
    <item>
      <title>Re: Overlay Two Graphs Together</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Overlay-Two-Graphs-Together/m-p/305493#M19452</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=webex_sentiment surveyDate=* Rating=*
| eval surveyDate=strptime(Started,"%m/%d/%Y %H:%M")
| eval YearWeek=strftime(surveyDate,"%Y-%U")
| search YearWeek!="2016-00"
| eval Rating = "Rating" . Rating
| chart count by YearWeek Rating
| addtotals fieldname=NumberRatings Rating*
| eval NegativeSentiment = Rating1 + Rating2
| fields YearWeek NumberRatings NegativeSentiment
| streamstats window=5 avg(NegativeSentiment) as MovingAverage_NegativeSentiment
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;It is slightly different, but should do the same thing. streamstats calculates a moving average based on the current value plus the previous five values, but you could change that as you like. I just wanted to show an alternative.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jul 2017 02:20:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Overlay-Two-Graphs-Together/m-p/305493#M19452</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2017-07-13T02:20:59Z</dc:date>
    </item>
    <item>
      <title>Re: Overlay Two Graphs Together</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Overlay-Two-Graphs-Together/m-p/305494#M19453</link>
      <description>&lt;P&gt;@Iguinn&lt;/P&gt;

&lt;P&gt;Thanks so much for your help. I input your code, but my search did not return any results.&lt;/P&gt;

&lt;P&gt;Here is the job inspection: &lt;A href="http://imgur.com/a/JMv3T"&gt;http://imgur.com/a/JMv3T&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;I believe the error may have something to do with the time range, but I'm not positive.&lt;/P&gt;

&lt;P&gt;Best,&lt;/P&gt;

&lt;P&gt;Matthew&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jul 2017 13:12:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Overlay-Two-Graphs-Together/m-p/305494#M19453</guid>
      <dc:creator>mhtedford</dc:creator>
      <dc:date>2017-07-13T13:12:31Z</dc:date>
    </item>
    <item>
      <title>Re: Overlay Two Graphs Together</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Overlay-Two-Graphs-Together/m-p/305495#M19454</link>
      <description>&lt;P&gt;@woodcock&lt;/P&gt;

&lt;P&gt;How do I do that?&lt;/P&gt;

&lt;P&gt;Best,&lt;BR /&gt;
Matthew&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jul 2017 13:13:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Overlay-Two-Graphs-Together/m-p/305495#M19454</guid>
      <dc:creator>mhtedford</dc:creator>
      <dc:date>2017-07-13T13:13:30Z</dc:date>
    </item>
    <item>
      <title>Re: Overlay Two Graphs Together</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Overlay-Two-Graphs-Together/m-p/305496#M19455</link>
      <description>&lt;P&gt;I think the error is because you put the word "search" at the very begging of the command line.&lt;/P&gt;

&lt;P&gt;The search command is implied. By putting the word "search" in the box, you asked Splunk to identify events with the literal keyword "search" in them. There probably aren't any events like that in your data. &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jul 2017 23:06:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Overlay-Two-Graphs-Together/m-p/305496#M19455</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2017-07-13T23:06:04Z</dc:date>
    </item>
    <item>
      <title>Re: Overlay Two Graphs Together</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Overlay-Two-Graphs-Together/m-p/305497#M19456</link>
      <description>&lt;P&gt;@lguinn &lt;/P&gt;

&lt;P&gt;I believe the problem may be elsewhere. I input your code here: &lt;A href="http://imgur.com/a/In8ij"&gt;http://imgur.com/a/In8ij&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;However, there are still no events shown.&lt;/P&gt;

&lt;P&gt;In the picture from my last comment, the "search" term was shown because I was inspecting the job.&lt;/P&gt;

&lt;P&gt;Thanks again; please let me know how to fix this if you can &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jul 2017 12:57:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Overlay-Two-Graphs-Together/m-p/305497#M19456</guid>
      <dc:creator>mhtedford</dc:creator>
      <dc:date>2017-07-14T12:57:27Z</dc:date>
    </item>
    <item>
      <title>Re: Overlay Two Graphs Together</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Overlay-Two-Graphs-Together/m-p/305498#M19457</link>
      <description>&lt;P&gt;What do you get if you just run the first part of the search&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=webex_sentiment surveyDate=* Rating=*
 | eval surveyDate=strptime(Started,"%m/%d/%Y %H:%M")
 | eval YearWeek=strftime(surveyDate,"%Y-%U")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 14 Jul 2017 21:09:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Overlay-Two-Graphs-Together/m-p/305498#M19457</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2017-07-14T21:09:20Z</dc:date>
    </item>
    <item>
      <title>Re: Overlay Two Graphs Together</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Overlay-Two-Graphs-Together/m-p/305499#M19458</link>
      <description>&lt;P&gt;@lguinn thanks so much!&lt;/P&gt;

&lt;P&gt;I found the problem was the "surveyDate=* Rating=*" at the start of the query.&lt;/P&gt;

&lt;P&gt;I deleted that phrase then re-ran your initial code:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=webex_sentiment 
 | eval surveyDate=strptime(Started,"%m/%d/%Y %H:%M")
 | eval YearWeek=strftime(surveyDate,"%Y-%U")
 | search YearWeek &amp;gt; "2016-12"
 | eval Rating = "Rating" . Rating
 | chart count by YearWeek Rating
 | addtotals fieldname=NumberRatings Rating*
 | eval NegativeSentiment = Rating1 + Rating2
 | fields YearWeek NumberRatings NegativeSentiment
 | streamstats window=5 avg(NegativeSentiment) as MovingAverage_NegativeSentiment
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I received this graph: &lt;A href="http://imgur.com/a/sC0Xz"&gt;http://imgur.com/a/sC0Xz&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;However, this displays the number of surveys with negative sentiment, rather than the percentage of surveys with negative sentiment.&lt;/P&gt;

&lt;P&gt;How do I make this change?&lt;/P&gt;</description>
      <pubDate>Mon, 17 Jul 2017 14:08:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Overlay-Two-Graphs-Together/m-p/305499#M19458</guid>
      <dc:creator>mhtedford</dc:creator>
      <dc:date>2017-07-17T14:08:53Z</dc:date>
    </item>
    <item>
      <title>Re: Overlay Two Graphs Together</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Overlay-Two-Graphs-Together/m-p/305500#M19459</link>
      <description>&lt;P&gt;@lguinn any update?&lt;/P&gt;</description>
      <pubDate>Mon, 24 Jul 2017 13:45:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Overlay-Two-Graphs-Together/m-p/305500#M19459</guid>
      <dc:creator>mhtedford</dc:creator>
      <dc:date>2017-07-24T13:45:49Z</dc:date>
    </item>
    <item>
      <title>Re: Overlay Two Graphs Together</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Overlay-Two-Graphs-Together/m-p/305501#M19460</link>
      <description>&lt;P&gt;Sorry, broke my arm so I am way behind on things that require typing.&lt;BR /&gt;
Add this to the end of your search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval PercentNegativeSentiment = (NegativeSentiment * 100) / NumberRatings
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Or you could make this the next-to-the-last line an compute the moving average based on the Percent...&lt;/P&gt;

&lt;P&gt;at the end you might want to use &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| fields - NegativeSentiment
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;or something like it to clean up the graph. You might consider removing the number of ratings as well, because the difference in scale may make the graph hard to read. You could always put total ratings on a separate graph...&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jul 2017 05:44:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Overlay-Two-Graphs-Together/m-p/305501#M19460</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2017-07-27T05:44:41Z</dc:date>
    </item>
  </channel>
</rss>

