<?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: Could you help me build a bar chart? in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/Could-you-help-me-build-a-bar-chart/m-p/386609#M42751</link>
    <description>&lt;P&gt;This query should produce the desired results.  After running it, choose "Stacked Column" from the Visualizations tab.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| stats count(eval(points&amp;gt;50)) as "COUNT(&amp;gt;50)", count(eval(points&amp;lt;=50)) as "COUNT(&amp;lt;=50)" by discipline
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sun, 06 Jan 2019 14:33:24 GMT</pubDate>
    <dc:creator>richgalloway</dc:creator>
    <dc:date>2019-01-06T14:33:24Z</dc:date>
    <item>
      <title>Could you help me build a bar chart?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Could-you-help-me-build-a-bar-chart/m-p/386608#M42750</link>
      <description>&lt;P&gt;Hey,&lt;/P&gt;

&lt;P&gt;Could you please help me?&lt;/P&gt;

&lt;P&gt;Suppose I have events like this:&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/6331iA9941A569F94506D/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Each event contains a student's assessment in five disciplines.&lt;/P&gt;

&lt;P&gt;The assessment is considered unsatisfactory if the student scored less than 50 points.&lt;/P&gt;

&lt;P&gt;You want to write a query that allows you to build a diagram of the following form:&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/6332i7D736393AFCADE44/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Thanks so much!&lt;/P&gt;</description>
      <pubDate>Sun, 06 Jan 2019 14:13:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Could-you-help-me-build-a-bar-chart/m-p/386608#M42750</guid>
      <dc:creator>stevesmith08</dc:creator>
      <dc:date>2019-01-06T14:13:29Z</dc:date>
    </item>
    <item>
      <title>Re: Could you help me build a bar chart?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Could-you-help-me-build-a-bar-chart/m-p/386609#M42751</link>
      <description>&lt;P&gt;This query should produce the desired results.  After running it, choose "Stacked Column" from the Visualizations tab.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| stats count(eval(points&amp;gt;50)) as "COUNT(&amp;gt;50)", count(eval(points&amp;lt;=50)) as "COUNT(&amp;lt;=50)" by discipline
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 06 Jan 2019 14:33:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Could-you-help-me-build-a-bar-chart/m-p/386609#M42751</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2019-01-06T14:33:24Z</dc:date>
    </item>
    <item>
      <title>Re: Could you help me build a bar chart?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Could-you-help-me-build-a-bar-chart/m-p/386610#M42752</link>
      <description>&lt;P&gt;Sorry, but what information do the “points” and “discipline” fields store?&lt;/P&gt;

&lt;P&gt;I may not have accurately put it, but the structure of each event is as follows:&lt;BR /&gt;
Surname = Smith, Math = 100, Physics = 65, History = 35, IT = 58, PE = 45&lt;BR /&gt;
Surname = Wilson, Math = 67, Physics = 60, History = 90, IT = 72, PE = 50&lt;BR /&gt;
...&lt;/P&gt;

&lt;P&gt;But your way is really good for a bar chart on each subject individually &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 06 Jan 2019 14:47:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Could-you-help-me-build-a-bar-chart/m-p/386610#M42752</guid>
      <dc:creator>stevesmith08</dc:creator>
      <dc:date>2019-01-06T14:47:29Z</dc:date>
    </item>
    <item>
      <title>Re: Could you help me build a bar chart?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Could-you-help-me-build-a-bar-chart/m-p/386611#M42753</link>
      <description>&lt;P&gt;@stevesmith08,&lt;/P&gt;

&lt;P&gt;Assuming you have your current search  as &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="your index" | table Surname,Math,Physics, History, IT, PE
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Lets &lt;CODE&gt;untable&lt;/CODE&gt; it to get the Marks as a column and Subject as rows for calculation.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;   index="your index" | table Surname,Math,Physics, History, IT, PE
   |untable Surname,Subject,Marks
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And now do  a conditional stats count : &lt;STRONG&gt;FINAL&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;   index="your index" | table Surname,Math,Physics, History, IT, PE
   |untable Surname,Subject,Marks
   |stats count(eval(Marks&amp;gt;50)) as "COUNT(&amp;gt;50)", count(eval(Marks&amp;lt;50)) as "COUNT(&amp;lt;50)" by Subject
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Run anywhere example&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_* earliest=-6m|timechart span=2m count as Marks by sourcetype|rename sourcetype as Subject,_time as Surname
|untable Surname,Subject,Marks
|stats count(eval(Marks&amp;gt;50)) as "COUNT(&amp;gt;50)", count(eval(Marks&amp;lt;50)) as "COUNT(&amp;lt;50)" by Subject
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 06 Jan 2019 15:07:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Could-you-help-me-build-a-bar-chart/m-p/386611#M42753</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2019-01-06T15:07:40Z</dc:date>
    </item>
    <item>
      <title>Re: Could you help me build a bar chart?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Could-you-help-me-build-a-bar-chart/m-p/386612#M42754</link>
      <description>&lt;P&gt;Points are scores and disciplines are subjects, using the terms in your OP.  My answer is completely invalidated by your comment giving the event format.  renjith.nair's answer appears to have nailed it.&lt;/P&gt;</description>
      <pubDate>Sun, 06 Jan 2019 15:19:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Could-you-help-me-build-a-bar-chart/m-p/386612#M42754</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2019-01-06T15:19:18Z</dc:date>
    </item>
  </channel>
</rss>

