<?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 Why am I not getting expected results using the chart command with the syntax &amp;quot;chart sum(fieldA) over FieldB by index&amp;quot;? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Why-am-I-not-getting-expected-results-using-the-chart-command/m-p/150629#M42207</link>
    <description>&lt;P&gt;Hi All,&lt;/P&gt;

&lt;P&gt;I am having issue with the search below. Hope you can point out where i am going wrong.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=index1 OR index=index2 OR index = index3  1234 OR 12345 OR 123456
| fields ORDERDATE,ORDERDATE,ORDERCREATEDATE,MERCHLINETOT,MERCHLINETOT,MERCHLINETOT,index
| eval fldNow=now() 
| eval ORDERCREATEDATE1=substr(ORDERCREATEDATE,7,10) 
| eval age=((ORDERCREATEDATE1-fldNow)/60)/60/24
| eval orderlinedate1=strptime(substr(ORDERDATE,1,8), "%Y%m%d") 
| eval age1=((orderlinedate1-fldNow)/60)/60/24
| eval orderlinedate2=strptime(substr(ORDERDATE,1,8), "%Y%m%d") 
| eval age2=((orderlinedate2-fldNow)/60)/60/24
| where (age &amp;lt;0 OR age1 &amp;lt;0  OR age2 &amp;lt;0 )
| eval age_group=case(age&amp;gt;-8 AND age&amp;lt;0,"Less than 7 days late",age&amp;gt;-15 AND age&amp;lt;-7," 7 and 14 days late",age&amp;gt;-22 AND age&amp;lt;-14,"between 14 and 21 days late",age&amp;lt;-21 ,"more than 21 days late")
| eval age_group1=case(age1&amp;gt;-8 AND age1&amp;lt;0,"Less than 7 days late",age1&amp;gt;-15 AND age1&amp;lt;-7," 7 and 14 days late",age1&amp;gt;-22 AND age1&amp;lt;-14," between 14 and 21 days late",age1&amp;lt;-21 ,"more than 21 days late")
| eval age_group2=case(age2&amp;gt;-8 AND age2&amp;lt;0,"Less than 7 days late",age2&amp;gt;-15 AND age2&amp;lt;-7,"7 and 14 days late",age2&amp;gt;-22 AND age2&amp;lt;-14," between 14 and 21 days late",age2&amp;lt;-21 ,"more than 21 days late")
| eval grouped_fields=coalesce(MERCHLINETOT,MERCHLINETOT,MERCHLINETOT)
| chart sum(MERCHLINETOT) over age_group2 by index 
| rename index1 as "StaleA", index2 as "StaleB", index3  as "StaleC"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;age= AGE OF 1234   = -1.5&lt;BR /&gt;
age1=AGE OF 12345  = -2.5&lt;BR /&gt;
age2=AGE OF 123456 = -3.5&lt;/P&gt;

&lt;P&gt;ALL THE ABOVE AGES fall under "Less than 7 days late" age_group category.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Problem:&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;
When I use: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; chart sum(MERCHLINETOT) over age_group2 by index
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;or&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;chart sum(MERCHLINETOT) over age_group1 by index 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I see the result only for StaleA and StaleB &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;age_group1            StaleA   StaleB
Less than 7 days late   79.70   95.92
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;When I use: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; chart sum(MERCHLINETOT) over age_group by index 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I see the result only for StaleC&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;age_group               StaleC  
Less than 7 days late   99.70
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Why am i not seeing the results for all 3 [StaleA , StaleB , Stale C] ?  What am i missing? Any guidance is really appreciated.&lt;/P&gt;

&lt;P&gt;Thank you.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Expected result&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;age_group               StaleA   StaleB   StaleC
Less than 7 days late    79.70  95.92   99.70
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Kindly let me know if you need more information.&lt;/P&gt;</description>
    <pubDate>Fri, 17 Apr 2015 23:54:13 GMT</pubDate>
    <dc:creator>nekbote</dc:creator>
    <dc:date>2015-04-17T23:54:13Z</dc:date>
    <item>
      <title>Why am I not getting expected results using the chart command with the syntax "chart sum(fieldA) over FieldB by index"?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-am-I-not-getting-expected-results-using-the-chart-command/m-p/150629#M42207</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;

&lt;P&gt;I am having issue with the search below. Hope you can point out where i am going wrong.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=index1 OR index=index2 OR index = index3  1234 OR 12345 OR 123456
| fields ORDERDATE,ORDERDATE,ORDERCREATEDATE,MERCHLINETOT,MERCHLINETOT,MERCHLINETOT,index
| eval fldNow=now() 
| eval ORDERCREATEDATE1=substr(ORDERCREATEDATE,7,10) 
| eval age=((ORDERCREATEDATE1-fldNow)/60)/60/24
| eval orderlinedate1=strptime(substr(ORDERDATE,1,8), "%Y%m%d") 
| eval age1=((orderlinedate1-fldNow)/60)/60/24
| eval orderlinedate2=strptime(substr(ORDERDATE,1,8), "%Y%m%d") 
| eval age2=((orderlinedate2-fldNow)/60)/60/24
| where (age &amp;lt;0 OR age1 &amp;lt;0  OR age2 &amp;lt;0 )
| eval age_group=case(age&amp;gt;-8 AND age&amp;lt;0,"Less than 7 days late",age&amp;gt;-15 AND age&amp;lt;-7," 7 and 14 days late",age&amp;gt;-22 AND age&amp;lt;-14,"between 14 and 21 days late",age&amp;lt;-21 ,"more than 21 days late")
| eval age_group1=case(age1&amp;gt;-8 AND age1&amp;lt;0,"Less than 7 days late",age1&amp;gt;-15 AND age1&amp;lt;-7," 7 and 14 days late",age1&amp;gt;-22 AND age1&amp;lt;-14," between 14 and 21 days late",age1&amp;lt;-21 ,"more than 21 days late")
| eval age_group2=case(age2&amp;gt;-8 AND age2&amp;lt;0,"Less than 7 days late",age2&amp;gt;-15 AND age2&amp;lt;-7,"7 and 14 days late",age2&amp;gt;-22 AND age2&amp;lt;-14," between 14 and 21 days late",age2&amp;lt;-21 ,"more than 21 days late")
| eval grouped_fields=coalesce(MERCHLINETOT,MERCHLINETOT,MERCHLINETOT)
| chart sum(MERCHLINETOT) over age_group2 by index 
| rename index1 as "StaleA", index2 as "StaleB", index3  as "StaleC"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;age= AGE OF 1234   = -1.5&lt;BR /&gt;
age1=AGE OF 12345  = -2.5&lt;BR /&gt;
age2=AGE OF 123456 = -3.5&lt;/P&gt;

&lt;P&gt;ALL THE ABOVE AGES fall under "Less than 7 days late" age_group category.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Problem:&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;
When I use: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; chart sum(MERCHLINETOT) over age_group2 by index
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;or&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;chart sum(MERCHLINETOT) over age_group1 by index 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I see the result only for StaleA and StaleB &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;age_group1            StaleA   StaleB
Less than 7 days late   79.70   95.92
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;When I use: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; chart sum(MERCHLINETOT) over age_group by index 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I see the result only for StaleC&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;age_group               StaleC  
Less than 7 days late   99.70
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Why am i not seeing the results for all 3 [StaleA , StaleB , Stale C] ?  What am i missing? Any guidance is really appreciated.&lt;/P&gt;

&lt;P&gt;Thank you.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Expected result&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;age_group               StaleA   StaleB   StaleC
Less than 7 days late    79.70  95.92   99.70
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Kindly let me know if you need more information.&lt;/P&gt;</description>
      <pubDate>Fri, 17 Apr 2015 23:54:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-am-I-not-getting-expected-results-using-the-chart-command/m-p/150629#M42207</guid>
      <dc:creator>nekbote</dc:creator>
      <dc:date>2015-04-17T23:54:13Z</dc:date>
    </item>
    <item>
      <title>Re: Why am I not getting expected results using the chart command with the syntax "chart sum(fieldA) over FieldB by index"?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-am-I-not-getting-expected-results-using-the-chart-command/m-p/150630#M42208</link>
      <description>&lt;P&gt;Hi nekbote, &lt;BR /&gt;
your are using many sources of data ( many index) . &lt;BR /&gt;
Try to COALESCE all the values of age_group1,age_group,........... in one global_age_group  and do the chart sum(...) over global_age_group&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 19:35:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-am-I-not-getting-expected-results-using-the-chart-command/m-p/150630#M42208</guid>
      <dc:creator>stephane_cyrill</dc:creator>
      <dc:date>2020-09-28T19:35:21Z</dc:date>
    </item>
    <item>
      <title>Re: Why am I not getting expected results using the chart command with the syntax "chart sum(fieldA) over FieldB by index"?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-am-I-not-getting-expected-results-using-the-chart-command/m-p/150631#M42209</link>
      <description>&lt;P&gt;Thanks alot Stephane....that solved my problem....!!!&lt;/P&gt;</description>
      <pubDate>Mon, 20 Apr 2015 18:18:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-am-I-not-getting-expected-results-using-the-chart-command/m-p/150631#M42209</guid>
      <dc:creator>nekbote</dc:creator>
      <dc:date>2015-04-20T18:18:22Z</dc:date>
    </item>
  </channel>
</rss>

