<?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 to find the value where the two lines meet (line chart) in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/how-to-find-the-value-where-the-two-lines-meet-line-chart/m-p/688787#M234795</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/228188"&gt;@zoe&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Building on&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/161352"&gt;@gcusello&lt;/a&gt;'s response, you can find the intersections by looking for sign changes in dy:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;| eval dy=y2-y1
| autoregress dy
| where dy==0 OR abs(dy)/dy!=abs(dy_p1)/dy_p1
| fields - dy dy_p1&lt;/LI-CODE&gt;&lt;P&gt;The selected point depends on the sort order of the data.&lt;/P&gt;&lt;P&gt;You can use this alone or as part of an annotation search in a dashboard.&lt;/P&gt;&lt;P&gt;We don't know the functions that generated the lines, and we're not performing a regression, but this provide a quick estimation.&lt;/P&gt;</description>
    <pubDate>Mon, 27 May 2024 14:18:17 GMT</pubDate>
    <dc:creator>tscroggins</dc:creator>
    <dc:date>2024-05-27T14:18:17Z</dc:date>
    <item>
      <title>how to find the value where the two lines meet (line chart)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-find-the-value-where-the-two-lines-meet-line-chart/m-p/688581#M234742</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;I have the table&lt;/P&gt;&lt;P&gt;x, y1, y2 and plot them in the line chart. how can I find the value where the two lines cross ?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="zoe_0-1716535899930.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/30987i7D3A9AD3FD626F5E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="zoe_0-1716535899930.png" alt="zoe_0-1716535899930.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 24 May 2024 07:36:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-find-the-value-where-the-two-lines-meet-line-chart/m-p/688581#M234742</guid>
      <dc:creator>zoe</dc:creator>
      <dc:date>2024-05-24T07:36:22Z</dc:date>
    </item>
    <item>
      <title>Re: how to find the value where the two lines meet (line chart)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-find-the-value-where-the-two-lines-meet-line-chart/m-p/688583#M234744</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/228188"&gt;@zoe&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;after a chart there's always a search and some results.&lt;/P&gt;&lt;P&gt;probably you have a search like the following:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;your_search&amp;gt;
| timechart count BY key&lt;/LI-CODE&gt;&lt;P&gt;wher key has two values (value1 and value2)&lt;/P&gt;&lt;P&gt;so you have to run a search like the following:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;your_search&amp;gt;
| timechart count BY key
| where value1=value2&lt;/LI-CODE&gt;&lt;P&gt;I could be more detailed, if you could share your search (in text mode, non screenshot!).&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 24 May 2024 07:42:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-find-the-value-where-the-two-lines-meet-line-chart/m-p/688583#M234744</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2024-05-24T07:42:09Z</dc:date>
    </item>
    <item>
      <title>Re: how to find the value where the two lines meet (line chart)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-find-the-value-where-the-two-lines-meet-line-chart/m-p/688588#M234748</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;SPAN&gt;Giuseppe,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;thanks for the quick reply.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I do not have timechart. I have a table with the fields like x, y1, y2. If I plot x-y1 and x-y2 in line chars, there two lines cross. I need the value on the&amp;nbsp; y1 line is the same like that on the y2 line.&amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;| where value1=value2&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;This solution would not work, because y1 and y2 do not have the same field values. I need to find the cross of there two artifical lines.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 24 May 2024 07:51:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-find-the-value-where-the-two-lines-meet-line-chart/m-p/688588#M234748</guid>
      <dc:creator>zoe</dc:creator>
      <dc:date>2024-05-24T07:51:34Z</dc:date>
    </item>
    <item>
      <title>Re: how to find the value where the two lines meet (line chart)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-find-the-value-where-the-two-lines-meet-line-chart/m-p/688590#M234749</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/228188"&gt;@zoe&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;even if you don't use timechart, I suppose that you are charting two fields value (y1 and y2), you have to compare the two fields in the where condition.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| where y1=y2&lt;/LI-CODE&gt;&lt;P&gt;or, if they are similar but ton the same:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| where y1-y2&amp;lt;1 OR y2-y1&amp;lt;1&lt;/LI-CODE&gt;&lt;P&gt;whwre 1 is the sensibility you want to use in your search.&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 24 May 2024 08:18:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-find-the-value-where-the-two-lines-meet-line-chart/m-p/688590#M234749</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2024-05-24T08:18:01Z</dc:date>
    </item>
    <item>
      <title>Re: how to find the value where the two lines meet (line chart)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-find-the-value-where-the-two-lines-meet-line-chart/m-p/688787#M234795</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/228188"&gt;@zoe&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Building on&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/161352"&gt;@gcusello&lt;/a&gt;'s response, you can find the intersections by looking for sign changes in dy:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;| eval dy=y2-y1
| autoregress dy
| where dy==0 OR abs(dy)/dy!=abs(dy_p1)/dy_p1
| fields - dy dy_p1&lt;/LI-CODE&gt;&lt;P&gt;The selected point depends on the sort order of the data.&lt;/P&gt;&lt;P&gt;You can use this alone or as part of an annotation search in a dashboard.&lt;/P&gt;&lt;P&gt;We don't know the functions that generated the lines, and we're not performing a regression, but this provide a quick estimation.&lt;/P&gt;</description>
      <pubDate>Mon, 27 May 2024 14:18:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-find-the-value-where-the-two-lines-meet-line-chart/m-p/688787#M234795</guid>
      <dc:creator>tscroggins</dc:creator>
      <dc:date>2024-05-27T14:18:17Z</dc:date>
    </item>
    <item>
      <title>Re: how to find the value where the two lines meet (line chart)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-find-the-value-where-the-two-lines-meet-line-chart/m-p/688796#M234797</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/228188"&gt;@zoe&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;building on previous suggestions from "&lt;U&gt;gcusello&lt;/U&gt; &amp;amp; &lt;U&gt;tscroggins&lt;/U&gt;" , especially that sometimes y1 and y2 might not be exactly equal&amp;nbsp;but rather close to each other, I would use the following method to find the closest intersections:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval diff=abs(y1 - y2)
| sort diff
| head 1
| table _time, y1, y2, diff&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;From there, you can use another diff (&lt;EM&gt;if needed&lt;/EM&gt;) to calculate the actual difference between the numbers stored in the y1 and y2 fields.&lt;/P&gt;&lt;P&gt;&lt;U&gt;Search Ref:&lt;/U&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;A title="Function: abs" href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/MathematicalFunctions" target="_blank" rel="noopener"&gt;Function: abs&lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;&lt;A title="Command: Sort" href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Sort" target="_blank" rel="noopener"&gt;Command: Sort&lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;&lt;A title="Command: Head" href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Head" target="_self"&gt;Command: Head&lt;/A&gt;&amp;nbsp;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;best regards,&lt;/P&gt;</description>
      <pubDate>Mon, 27 May 2024 16:03:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-find-the-value-where-the-two-lines-meet-line-chart/m-p/688796#M234797</guid>
      <dc:creator>emdaax</dc:creator>
      <dc:date>2024-05-27T16:03:54Z</dc:date>
    </item>
    <item>
      <title>Re: how to find the value where the two lines meet (line chart)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-find-the-value-where-the-two-lines-meet-line-chart/m-p/688804#M234799</link>
      <description>&lt;P&gt;That will give you one solution, but the other is more generalized:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;| makeresults count=100
| streamstats count
| eval count=count-1
| rename count as x
| eval y1=pow(x-50, 2)+25, y2=-pow(x-30, 2)+1000
| table x y1 y2
``` end sample data ```
| eval dy=y2-y1
| autoregress dy
| where dy==0 OR abs(dy)/dy!=abs(dy_p1)/dy_p1
| fields - dy dy_p1&lt;/LI-CODE&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%"&gt;&lt;STRONG&gt;x&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;&lt;STRONG&gt;y1&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;&lt;STRONG&gt;y2&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%"&gt;21&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;866&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;919&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%"&gt;60&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;125&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;100&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If we find the intersections outside Splunk we get:&lt;/P&gt;&lt;P&gt;x ~ 20.315, y ~ 906.2&lt;BR /&gt;x ~ 59.685, y ~ 118.8&lt;/P&gt;</description>
      <pubDate>Mon, 27 May 2024 18:32:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-find-the-value-where-the-two-lines-meet-line-chart/m-p/688804#M234799</guid>
      <dc:creator>tscroggins</dc:creator>
      <dc:date>2024-05-27T18:32:38Z</dc:date>
    </item>
  </channel>
</rss>

