<?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 display charts based on condition by some field in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-display-charts-based-on-condition-by-some-field/m-p/467950#M131745</link>
    <description>&lt;PRE&gt;&lt;CODE&gt;| gentimes start=01/01/2019 
| rename starttime as _time 
| timechart span=1month count 
| eval time = strftime(_time ,"%b") 
| table time count 
| transpose 0 header_field=time column_name=Users 
| table Users Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec 
| eval user=mvrange(0,4) 
| mvexpand user 
| foreach * [ eval &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt; = random() % 100 + 10]
| streamstats count 
| eval result=if(count % 2 = 1,"found","Not_Found") 
| eval Users=if(count &amp;lt;= 2,"ABC","XYZ") 
| table Users result Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
`comment("this is your sample. From here, the logic")`
| eval tmp=Users.":".result
| fields - Users result
| transpose 0 header_field=tmp column_name=month
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Visualization &amp;gt;&amp;gt; Column Chart with &lt;EM&gt;overlay&lt;/EM&gt;  &lt;CODE&gt;ABC:Not_Found&lt;/CODE&gt; and &lt;CODE&gt;XYZ:Not_Found&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Hi, folks. how about this?&lt;/P&gt;</description>
    <pubDate>Fri, 07 Feb 2020 00:34:47 GMT</pubDate>
    <dc:creator>to4kawa</dc:creator>
    <dc:date>2020-02-07T00:34:47Z</dc:date>
    <item>
      <title>How to display charts based on condition by some field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-display-charts-based-on-condition-by-some-field/m-p/467947#M131742</link>
      <description>&lt;P&gt;Hi , &lt;BR /&gt;
I want to display two charts , one column and line chart in single panel based on condition.&lt;BR /&gt;
For example, if result=found then column chart based on user for all months and when result="not found" then line chart based on user &lt;BR /&gt;
My data is like,&lt;BR /&gt;
Users  result               Jan   Feb  Mar Apr May Jun July .. Dec&lt;BR /&gt;
ABC     found              100  102  103  102 100 105 200...  70&lt;BR /&gt;
ABC     Not-Found       20   50    22     30    60   22   43 ....  10&lt;BR /&gt;
XYZ     found                120  80   70 ..........................................&lt;BR /&gt;
XYZ     Not-Found         24   30   15 .........................................&lt;/P&gt;

&lt;P&gt;Now, want to display coulmn chart when result=found ,x-axis (Months) and in Y-axis (months Value)  by Users and&lt;BR /&gt;
in same panel want to show line chart when result=not found , ,x-axis (Months) and in Y-axis (months Value)  by Users&lt;/P&gt;

&lt;P&gt;Please suggest.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Feb 2020 08:00:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-display-charts-based-on-condition-by-some-field/m-p/467947#M131742</guid>
      <dc:creator>avni26</dc:creator>
      <dc:date>2020-02-06T08:00:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to display charts based on condition by some field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-display-charts-based-on-condition-by-some-field/m-p/467948#M131743</link>
      <description>&lt;P&gt;You do not want to chart individual users correct? Because that could be a MASSIVELY long chart if you have hundreds of users.&lt;/P&gt;

&lt;P&gt;You just want a TOTAL COUNT of users found and not found?&lt;/P&gt;</description>
      <pubDate>Thu, 06 Feb 2020 17:06:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-display-charts-based-on-condition-by-some-field/m-p/467948#M131743</guid>
      <dc:creator>13tsavage</dc:creator>
      <dc:date>2020-02-06T17:06:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to display charts based on condition by some field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-display-charts-based-on-condition-by-some-field/m-p/467949#M131744</link>
      <description>&lt;P&gt;You could use post process searches in your dashboard and feed 2 post process searches to each of the visualization.&lt;/P&gt;

&lt;P&gt;Base search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Your base search giving fields Users result Jan Feb...
| eval temp=Users."##".result | fields - Users result
| untable temp month valueForMonth
| rex field=temp "(?&amp;lt;Users&amp;gt;.+)##(?&amp;lt;result&amp;gt;.+)" | fields - temp
| stats sum(valueForMonth) as valueForMonth by month result
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Post process 1 - for column chart&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| where result="found" | table month valueForMonth
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Post process 2 - for line chart&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| where result="No-found" | table month valueForMonth
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;For example on how to write post process searches for dashboard, refer to this Splunk documentation:&lt;BR /&gt;
&lt;A href="https://docs.splunk.com/Documentation/Splunk/8.0.1/Viz/Savedsearches#Examples_2"&gt;https://docs.splunk.com/Documentation/Splunk/8.0.1/Viz/Savedsearches#Examples_2&lt;/A&gt; (first example is close to what you need)&lt;/P&gt;</description>
      <pubDate>Thu, 06 Feb 2020 22:22:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-display-charts-based-on-condition-by-some-field/m-p/467949#M131744</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2020-02-06T22:22:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to display charts based on condition by some field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-display-charts-based-on-condition-by-some-field/m-p/467950#M131745</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;| gentimes start=01/01/2019 
| rename starttime as _time 
| timechart span=1month count 
| eval time = strftime(_time ,"%b") 
| table time count 
| transpose 0 header_field=time column_name=Users 
| table Users Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec 
| eval user=mvrange(0,4) 
| mvexpand user 
| foreach * [ eval &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt; = random() % 100 + 10]
| streamstats count 
| eval result=if(count % 2 = 1,"found","Not_Found") 
| eval Users=if(count &amp;lt;= 2,"ABC","XYZ") 
| table Users result Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
`comment("this is your sample. From here, the logic")`
| eval tmp=Users.":".result
| fields - Users result
| transpose 0 header_field=tmp column_name=month
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Visualization &amp;gt;&amp;gt; Column Chart with &lt;EM&gt;overlay&lt;/EM&gt;  &lt;CODE&gt;ABC:Not_Found&lt;/CODE&gt; and &lt;CODE&gt;XYZ:Not_Found&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Hi, folks. how about this?&lt;/P&gt;</description>
      <pubDate>Fri, 07 Feb 2020 00:34:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-display-charts-based-on-condition-by-some-field/m-p/467950#M131745</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-02-07T00:34:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to display charts based on condition by some field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-display-charts-based-on-condition-by-some-field/m-p/467951#M131746</link>
      <description>&lt;P&gt;@to4kawa Thanks, it worked perfectly as per my requirement.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Feb 2020 08:59:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-display-charts-based-on-condition-by-some-field/m-p/467951#M131746</guid>
      <dc:creator>avni26</dc:creator>
      <dc:date>2020-02-07T08:59:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to display charts based on condition by some field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-display-charts-based-on-condition-by-some-field/m-p/589654#M205312</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;How can we apply if else condition to following chart command such that if the value in a cell is 0, the cell is empty else it displays the cell content.&lt;/P&gt;&lt;P&gt;| chart sum(field1) OVER field2 BY field3&lt;/P&gt;&lt;P&gt;The above command gives a tabular result with field2 values on Y axis, field3 values on X axis, and sum(field1) data in cells for each field2 and field3.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to keep the cells which evaluate to sum(field1)=0, but want to keep those cells empty.&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Fri, 18 Mar 2022 09:56:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-display-charts-based-on-condition-by-some-field/m-p/589654#M205312</guid>
      <dc:creator>Taruchit</dc:creator>
      <dc:date>2022-03-18T09:56:00Z</dc:date>
    </item>
  </channel>
</rss>

