<?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 Select field with highest value within single event for a dashboard panel in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/Select-field-with-highest-value-within-single-event-for-a/m-p/424893#M27989</link>
    <description>&lt;P&gt;Hi all, &lt;/P&gt;

&lt;P&gt;I'm trying to get the hang of Splunk and was stuck somewhere (who wasn't? :). I did search other topics to no avail. &lt;/P&gt;

&lt;P&gt;I have events that contain stats from more than one device in a system, such as a bunch of battery voltages. Sample fields from an event could be: &lt;BR /&gt;
Timestamp, BAT0Voltage, BAT1Voltage, BAT2Voltage, BAT3Voltage&lt;/P&gt;

&lt;P&gt;I'm trying to include the BATxVoltage field with the largest value in a dashboard single-value panel. So I would see 566 Volts in the panel for the following sample event: &lt;BR /&gt;
$Timestamp, 566, 543, 512, 499&lt;/P&gt;

&lt;P&gt;But the dashboard would show 593 from this one: &lt;BR /&gt;
$Timestamp, 566, 543, 593, 496&lt;/P&gt;

&lt;P&gt;See, BAT0Voltage was selected in the first event, but BAT2Voltage is selected in the second as it has the largest value in a string of fields. &lt;/P&gt;

&lt;P&gt;Thanks in advance to anyone with any ideas (working or not!). &lt;/P&gt;</description>
    <pubDate>Thu, 13 Jun 2019 07:22:42 GMT</pubDate>
    <dc:creator>emirhand</dc:creator>
    <dc:date>2019-06-13T07:22:42Z</dc:date>
    <item>
      <title>Select field with highest value within single event for a dashboard panel</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Select-field-with-highest-value-within-single-event-for-a/m-p/424893#M27989</link>
      <description>&lt;P&gt;Hi all, &lt;/P&gt;

&lt;P&gt;I'm trying to get the hang of Splunk and was stuck somewhere (who wasn't? :). I did search other topics to no avail. &lt;/P&gt;

&lt;P&gt;I have events that contain stats from more than one device in a system, such as a bunch of battery voltages. Sample fields from an event could be: &lt;BR /&gt;
Timestamp, BAT0Voltage, BAT1Voltage, BAT2Voltage, BAT3Voltage&lt;/P&gt;

&lt;P&gt;I'm trying to include the BATxVoltage field with the largest value in a dashboard single-value panel. So I would see 566 Volts in the panel for the following sample event: &lt;BR /&gt;
$Timestamp, 566, 543, 512, 499&lt;/P&gt;

&lt;P&gt;But the dashboard would show 593 from this one: &lt;BR /&gt;
$Timestamp, 566, 543, 593, 496&lt;/P&gt;

&lt;P&gt;See, BAT0Voltage was selected in the first event, but BAT2Voltage is selected in the second as it has the largest value in a string of fields. &lt;/P&gt;

&lt;P&gt;Thanks in advance to anyone with any ideas (working or not!). &lt;/P&gt;</description>
      <pubDate>Thu, 13 Jun 2019 07:22:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Select-field-with-highest-value-within-single-event-for-a/m-p/424893#M27989</guid>
      <dc:creator>emirhand</dc:creator>
      <dc:date>2019-06-13T07:22:42Z</dc:date>
    </item>
    <item>
      <title>Re: Select field with highest value within single event for a dashboard panel</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Select-field-with-highest-value-within-single-event-for-a/m-p/424894#M27990</link>
      <description>&lt;P&gt;This run-anywhere example shows one way to do that.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults annotate=t | eval BAT0Voltage=521, BAT1Voltage=500, BAT2Voltage=509, BAT3Voltage=593 | eval MaxVoltage=0 | foreach BAT*Voltage [eval MaxVoltage=if('&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;' &amp;gt; MaxVoltage, '&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;', MaxVoltage)] | table MaxVoltage
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 13 Jun 2019 13:04:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Select-field-with-highest-value-within-single-event-for-a/m-p/424894#M27990</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2019-06-13T13:04:21Z</dc:date>
    </item>
    <item>
      <title>Re: Select field with highest value within single event for a dashboard panel</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Select-field-with-highest-value-within-single-event-for-a/m-p/424895#M27991</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/188284"&gt;@emirhand&lt;/a&gt; ,&lt;BR /&gt;
The answer provided by &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/213957"&gt;@richgalloway&lt;/a&gt; works and provides a table of maximum values.  However, if you're looking for a single value for a particular device to display on a dashboard, you might try this:&lt;BR /&gt;
&lt;PRE&gt;| makeresults &lt;BR /&gt;
| eval _time=now(), device="UPS001", BAT0Voltage=521, BAT1Voltage=500, BAT2Voltage=509, BAT3Voltage=593 &lt;BR /&gt;
| stats latest(BAT*) as BAT* by device &lt;BR /&gt;
| where device="UPS001" &lt;BR /&gt;
| table BAT*&lt;BR /&gt;
| transpose &lt;BR /&gt;
| stats max("row 1") as MaxVoltage&lt;/PRE&gt;&lt;BR /&gt;
In the above example, I'm creating a dummy event for a device called UPS001 with 4 battery voltage values.  We run a stats to get the most recent value for all devices, then we filter to a specific device (UPS001 in this case).  After that we use a transpose command to line all the fields up in a column so that we can run a simple stats command to get the maximum value for the UPS001 device.&lt;BR /&gt;
&lt;IMG src="https://community.splunk.com/storage/temp/273908-screenshot-from-2019-06-13-09-53-20.png" alt="alt text" /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 00:55:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Select-field-with-highest-value-within-single-event-for-a/m-p/424895#M27991</guid>
      <dc:creator>jnudell_2</dc:creator>
      <dc:date>2020-09-30T00:55:29Z</dc:date>
    </item>
    <item>
      <title>Re: Select field with highest value within single event for a dashboard panel</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Select-field-with-highest-value-within-single-event-for-a/m-p/424896#M27992</link>
      <description>&lt;P&gt;Thank you both. I think answer by &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/186296"&gt;@jnudell_2&lt;/a&gt; fits better for &lt;EM&gt;my&lt;/EM&gt; purposes, and &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/213957"&gt;@richgalloway&lt;/a&gt;'s answer is archived to use for a better fit in the future. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; &lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 00:54:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Select-field-with-highest-value-within-single-event-for-a/m-p/424896#M27992</guid>
      <dc:creator>emirhand</dc:creator>
      <dc:date>2020-09-30T00:54:51Z</dc:date>
    </item>
  </channel>
</rss>

