<?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: How can I show the single value and the trendline number at the same time? in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-show-the-single-value-and-the-trendline-number-at-the/m-p/387704#M25415</link>
    <description>&lt;P&gt;Try adding &lt;CODE&gt;| tail 2&lt;/CODE&gt; at the end of your current search.&lt;/P&gt;</description>
    <pubDate>Mon, 07 Jan 2019 20:07:57 GMT</pubDate>
    <dc:creator>somesoni2</dc:creator>
    <dc:date>2019-01-07T20:07:57Z</dc:date>
    <item>
      <title>How can I show the single value and the trendline number at the same time?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-show-the-single-value-and-the-trendline-number-at-the/m-p/387703#M25414</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I want to show a number in a single value and other number in a trendline with the arrow.&lt;BR /&gt;
For example A, I have this query:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=quickpay host=f1cloud* "*CompraAutorizacionGenerar* response*" ("xxxxx") sourcetype=QP_busadapter| dedup logid | search "codResp"=0""| rex "\[(?\w+)ServiceStub]" | rex "#MID=(?\w+)#C*" | eval Comercio=case(Comercio=="xxxxx","FACL BF") | rex field=_raw "(?P.+)" | table _time Comercio responseDesc logid  | addcoltotals labelfield=logid | timechart span=30m count(logid) as "Cantidad de autorizaciones"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And it shows like this:&lt;BR /&gt;
&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/6336i606340A14F869129/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Then, the results show like this:&lt;BR /&gt;
&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/6337i8A4A5225144FEC64/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;But, if you see, image 1 shows the trendline with the difference between the last number and the penultimate number: 19 - 5 = 14 and it shows -14 in trendline.&lt;/P&gt;

&lt;P&gt;But we want to show in trendline the penultimate number, 19, with the arrow downing, because the last number was 5.&lt;/P&gt;

&lt;P&gt;How can I show this in Splunk?&lt;/P&gt;

&lt;P&gt;Thank you!!&lt;/P&gt;</description>
      <pubDate>Mon, 07 Jan 2019 18:24:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-show-the-single-value-and-the-trendline-number-at-the/m-p/387703#M25414</guid>
      <dc:creator>czunigab</dc:creator>
      <dc:date>2019-01-07T18:24:58Z</dc:date>
    </item>
    <item>
      <title>Re: How can I show the single value and the trendline number at the same time?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-show-the-single-value-and-the-trendline-number-at-the/m-p/387704#M25415</link>
      <description>&lt;P&gt;Try adding &lt;CODE&gt;| tail 2&lt;/CODE&gt; at the end of your current search.&lt;/P&gt;</description>
      <pubDate>Mon, 07 Jan 2019 20:07:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-show-the-single-value-and-the-trendline-number-at-the/m-p/387704#M25415</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2019-01-07T20:07:57Z</dc:date>
    </item>
    <item>
      <title>Re: How can I show the single value and the trendline number at the same time?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-show-the-single-value-and-the-trendline-number-at-the/m-p/387705#M25416</link>
      <description>&lt;P&gt;Hi, I tried, but I got the response: "no results found" &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Jan 2019 21:29:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-show-the-single-value-and-the-trendline-number-at-the/m-p/387705#M25416</guid>
      <dc:creator>czunigab</dc:creator>
      <dc:date>2019-01-07T21:29:35Z</dc:date>
    </item>
    <item>
      <title>Re: How can I show the single value and the trendline number at the same time?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-show-the-single-value-and-the-trendline-number-at-the/m-p/387706#M25417</link>
      <description>&lt;P&gt;| sort - _time | head 2&lt;/P&gt;</description>
      <pubDate>Thu, 10 Jan 2019 01:36:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-show-the-single-value-and-the-trendline-number-at-the/m-p/387706#M25417</guid>
      <dc:creator>felipesewaybric</dc:creator>
      <dc:date>2019-01-10T01:36:45Z</dc:date>
    </item>
    <item>
      <title>Re: How can I show the single value and the trendline number at the same time?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-show-the-single-value-and-the-trendline-number-at-the/m-p/387707#M25418</link>
      <description>&lt;P&gt;I cannot find any way to fake it (I tried &lt;CODE&gt;fieldformat&lt;/CODE&gt; and several other trickeries) and the documentation (&lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/Viz/SingleValueFormatting"&gt;https://docs.splunk.com/Documentation/Splunk/latest/Viz/SingleValueFormatting&lt;/A&gt;) does not list out any options so it looks like you will have to make your own custom viz.  For anybody else having a go, here is some SPL to get you started:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|  makeresults 
|  eval value="8 9 8 11 15 7 11 19 5"
|  makemv value
| mvexpand value
| streamstats count AS _pos
| eventstats max(_pos) AS _count
| eval _time = _time + _pos
| eval _showvalue=if(_pos == (_count - 1), value, null())
| eventstats first(_showvalue) AS _showvalue
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 10 Jan 2019 02:05:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-show-the-single-value-and-the-trendline-number-at-the/m-p/387707#M25418</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-01-10T02:05:42Z</dc:date>
    </item>
    <item>
      <title>Re: How can I show the single value and the trendline number at the same time?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-show-the-single-value-and-the-trendline-number-at-the/m-p/387708#M25419</link>
      <description>&lt;P&gt;This will not work.  It only appeared to work because Splunk resorted your list and reversed it.  If you add a &lt;CODE&gt;| sort 0 _time&lt;/CODE&gt; to put it back to the way that &lt;CODE&gt;timechart&lt;/CODE&gt; sorts it, you will see that this does not work.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Jan 2019 02:07:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-show-the-single-value-and-the-trendline-number-at-the/m-p/387708#M25419</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-01-10T02:07:14Z</dc:date>
    </item>
    <item>
      <title>Re: How can I show the single value and the trendline number at the same time?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-show-the-single-value-and-the-trendline-number-at-the/m-p/387709#M25420</link>
      <description>&lt;P&gt;This, gives the right big number, but destroys the trendline and gives the wrong trend value.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Jan 2019 02:11:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-show-the-single-value-and-the-trendline-number-at-the/m-p/387709#M25420</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-01-10T02:11:47Z</dc:date>
    </item>
    <item>
      <title>Re: How can I show the single value and the trendline number at the same time?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-show-the-single-value-and-the-trendline-number-at-the/m-p/387710#M25421</link>
      <description>&lt;P&gt;Yes, it destroy the trendline and it shows wrong values&lt;/P&gt;</description>
      <pubDate>Fri, 11 Jan 2019 16:07:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-show-the-single-value-and-the-trendline-number-at-the/m-p/387710#M25421</guid>
      <dc:creator>czunigab</dc:creator>
      <dc:date>2019-01-11T16:07:12Z</dc:date>
    </item>
    <item>
      <title>Re: How can I show the single value and the trendline number at the same time?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-show-the-single-value-and-the-trendline-number-at-the/m-p/387711#M25422</link>
      <description>&lt;P&gt;@czunigab , As you already have seen &lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Default Single Value Trend behavior&lt;/STRONG&gt; compares final result with penultimate result and &lt;CODE&gt;shows the final value as the Single Value and Difference between final and penultimate value as Trend Value. Positive or Negative Shows the trend Up or Down&lt;/CODE&gt;&lt;BR /&gt;
However, your &lt;STRONG&gt;expected behavior&lt;/STRONG&gt; is to &lt;CODE&gt;show penultimate result as Single Value and Final value as Trend Value along with actual trend indicator&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;As stated by @woodcock with built in Single value visualization behavior your expected output would not be possible if you want to show trend as well. So you can try with the following without trendline.&lt;/P&gt;

&lt;P&gt;Try the following run anywhere examples&lt;BR /&gt;
&lt;STRONG&gt;Option 1 : Show only last two values no trendline&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval _time=relative_time(_time,"@h") 
| eval logid="8 9 8 11 15 7 11 19 5", delta_time=1800 
| makemv logid delim=" " 
| mvexpand logid 
| accum delta_time 
| eval _time=_time-delta_time 
| table _time logid
| tail 2
| reverse
| streamstats count as sno
| streamstats current=f window=1 last(logid) as prev
| reverse
| streamstats current=f window=1 last(logid) as next
| eval logid=if(sno=2,logid+prev,logid)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;Option 2: Single Value and Trend as per your requirement but Trendline will not be correct for the final two results&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval _time=relative_time(_time,"@h") 
| eval logid="8 9 8 11 15 7 11 19 5", delta_time=1800 
| makemv logid delim=" " 
| mvexpand logid 
| accum delta_time 
| eval _time=_time-delta_time 
| table _time logid
| reverse
| streamstats last(logid) as next_logid current=f window=1
| streamstats count as sno
| reverse
| streamstats last(logid) as prev_logid current=f window=1
| eval final_logid=case(sno=1,prev_logid,sno=2,logid+next_logid,true(),logid)
| table _time final_logid
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If you want both trend and trendline as per your expectation you might have to use JavaScript to override the Values in Single Value Visualization for Single Result and Trend values.&lt;/P&gt;</description>
      <pubDate>Fri, 11 Jan 2019 17:30:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-show-the-single-value-and-the-trendline-number-at-the/m-p/387711#M25422</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2019-01-11T17:30:32Z</dc:date>
    </item>
  </channel>
</rss>

