<?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: Percentage of two calculated search values in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Percentage-of-two-calculated-search-values/m-p/489186#M140342</link>
    <description>&lt;P&gt;try &lt;CODE&gt;multireport&lt;/CODE&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| where 'usage_info.d_w'&amp;gt;=0 or 'usage_info.solar_w'&amp;gt;=0 
| bin _time span=1h 
| multireport 
    [| stats count as samplesU sum(usage_info.d_w) as watt_sumU by _time 
    | eval kW_SumU=watt_sumU/1000 
    | eval avg_kWhU=kW_SumU/samplesU ] 
    [| stats count as samplesP sum(usage_info.solar_w) as watt_sumP by _time 
    | eval kW_SumP=watt_sumP/1000 
    | eval avg_kWhP=kW_SumP/samplesP ] 
| selfjoin _time
| eval percent_powered=round((avg_kWhP/avg_kWhU)*100),2)
| table percent_powered
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;CODE&gt;multireport&lt;/CODE&gt; has no reference.&lt;/P&gt;

&lt;P&gt;reference:&lt;BR /&gt;
&lt;A href="https://www.google.com/search?q=multireport+splunk"&gt;https://www.google.com/search?q=multireport+splunk&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;don't hate me @to4kawa&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;No, I don't think so.&lt;/P&gt;</description>
    <pubDate>Thu, 30 Apr 2020 01:05:00 GMT</pubDate>
    <dc:creator>to4kawa</dc:creator>
    <dc:date>2020-04-30T01:05:00Z</dc:date>
    <item>
      <title>Percentage of two calculated search values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Percentage-of-two-calculated-search-values/m-p/489185#M140341</link>
      <description>&lt;P&gt;don't hate me &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/184221"&gt;@to4kawa&lt;/a&gt;  But can you help me one last time!   Ive been stuck for a few hours trying to figure out how to do this, my splunk forum searches are getting me close, but I'm not sure how to go about it...   I know the below search is incorrect, but i need to come up with the "avg_kWhU" value and and the "avg_kWhP" value in one search, and then find the percentage difference between kwh used and kwh produced.     for example if kWhP was 50  and kWhU was 50   Percent_powered would be 100% &lt;/P&gt;

&lt;P&gt;i think i cant have two bins grouping by _time?  I have tried many things, and seem to be stuck  &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| where 'usage_info.d_w'&amp;gt;=0 or 'usage_info.solar_w'&amp;gt;=0 
| bin _time span=1h

  | stats count as samplesU sum(usage_info.d_w) as watt_sumU by _time
  | eval kW_SumU=watt_sumU/1000
  | eval avg_kWhU=kW_SumU/samplesU

  | stats count as samplesP sum(usage_info.solar_w) as watt_sumP by _time
  | eval kW_SumP=watt_sumP/1000
  | eval avg_kWhP=kW_SumP/samplesP

| eval percent_powered=((avg_kWhP/avg_kWhU)100) 
| table percent_powered
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 30 Sep 2020 05:15:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Percentage-of-two-calculated-search-values/m-p/489185#M140341</guid>
      <dc:creator>pir8radio</dc:creator>
      <dc:date>2020-09-30T05:15:35Z</dc:date>
    </item>
    <item>
      <title>Re: Percentage of two calculated search values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Percentage-of-two-calculated-search-values/m-p/489186#M140342</link>
      <description>&lt;P&gt;try &lt;CODE&gt;multireport&lt;/CODE&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| where 'usage_info.d_w'&amp;gt;=0 or 'usage_info.solar_w'&amp;gt;=0 
| bin _time span=1h 
| multireport 
    [| stats count as samplesU sum(usage_info.d_w) as watt_sumU by _time 
    | eval kW_SumU=watt_sumU/1000 
    | eval avg_kWhU=kW_SumU/samplesU ] 
    [| stats count as samplesP sum(usage_info.solar_w) as watt_sumP by _time 
    | eval kW_SumP=watt_sumP/1000 
    | eval avg_kWhP=kW_SumP/samplesP ] 
| selfjoin _time
| eval percent_powered=round((avg_kWhP/avg_kWhU)*100),2)
| table percent_powered
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;CODE&gt;multireport&lt;/CODE&gt; has no reference.&lt;/P&gt;

&lt;P&gt;reference:&lt;BR /&gt;
&lt;A href="https://www.google.com/search?q=multireport+splunk"&gt;https://www.google.com/search?q=multireport+splunk&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;don't hate me @to4kawa&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;No, I don't think so.&lt;/P&gt;</description>
      <pubDate>Thu, 30 Apr 2020 01:05:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Percentage-of-two-calculated-search-values/m-p/489186#M140342</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-04-30T01:05:00Z</dc:date>
    </item>
    <item>
      <title>Re: Percentage of two calculated search values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Percentage-of-two-calculated-search-values/m-p/489187#M140343</link>
      <description>&lt;P&gt;I didn't even know this was possible.  thanks!   &lt;/P&gt;</description>
      <pubDate>Thu, 30 Apr 2020 14:17:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Percentage-of-two-calculated-search-values/m-p/489187#M140343</guid>
      <dc:creator>pir8radio</dc:creator>
      <dc:date>2020-04-30T14:17:50Z</dc:date>
    </item>
  </channel>
</rss>

