<?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: Help getting count by letter grade based on score range in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Help-getting-count-by-letter-grade-based-on-score-range/m-p/633676#M220100</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/246034"&gt;@Diana_a&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;good for you, see next time!&lt;/P&gt;&lt;P&gt;Ciao and happy splunking&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;&lt;P&gt;P.S.: Karma Points are appreciated by all the contributors &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 08 Mar 2023 07:01:44 GMT</pubDate>
    <dc:creator>gcusello</dc:creator>
    <dc:date>2023-03-08T07:01:44Z</dc:date>
    <item>
      <title>Help getting count by letter grade based on score range</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-getting-count-by-letter-grade-based-on-score-range/m-p/598738#M208486</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I was hoping someone can help me, though I have seen some examples, but all of them involve case.&amp;nbsp;&lt;BR /&gt;I need to create a statistical table that would give me the letter grade, count, percentage and grand total as the last column (the last one is just for me to see the actual total)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE width="294"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="102"&gt;Letter grade&lt;/TD&gt;
&lt;TD width="64"&gt;Count&lt;/TD&gt;
&lt;TD width="64"&gt;Perc %&lt;/TD&gt;
&lt;TD width="64"&gt;Grand Total&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;A&lt;/TD&gt;
&lt;TD&gt;33&lt;/TD&gt;
&lt;TD&gt;33.33&lt;/TD&gt;
&lt;TD&gt;100&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;B&lt;/TD&gt;
&lt;TD&gt;33&lt;/TD&gt;
&lt;TD&gt;33.33&lt;/TD&gt;
&lt;TD&gt;100&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;C...&lt;/TD&gt;
&lt;TD&gt;33...&lt;/TD&gt;
&lt;TD&gt;33.33...&lt;/TD&gt;
&lt;TD&gt;100 ...&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;no score&lt;/TD&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;TD&gt;100&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I wrote in SQL where I join 2 tables the ones with the SCORES and one with the STUDENTS. If a student does not have a score or it's a zero, they should just go to the no score bucket.&lt;/P&gt;
&lt;P&gt;SELECT t.SCORE as [grade],&lt;BR /&gt;count(*) [counter],&lt;BR /&gt;count(*)*100.00 / SUM(COUNT(*)) OVER() as [perc students %],&lt;BR /&gt;SUM(COUNT(*)) OVER() as [total students]&lt;BR /&gt;FROM&lt;BR /&gt;( select case&lt;BR /&gt;when SCORE = 0 then 'no score or zero'&lt;BR /&gt;when SCORE between 1 and 59 THEN 'F'&lt;BR /&gt;when SCORE between 60 AND 69 THEN 'D'&lt;BR /&gt;when SCORE between 70 AND 79 THEN 'C'&lt;BR /&gt;when SCORE between 80 AND 89 THEN 'B'&lt;BR /&gt;else 'A' end as SCORE&lt;BR /&gt;FROM&lt;BR /&gt;[main_db].[dbo].[scores]&lt;BR /&gt;RIGHT JOIN [main_db].[dbo].[students] ON [scores].STUDENTNUMBER = [students].STUDENTNUMBER&lt;BR /&gt;) t&lt;BR /&gt;Group by t.SCORE&lt;/P&gt;
&lt;P&gt;My SPL I have so far is that I need join them but I am having a hard time:&lt;/P&gt;
&lt;P&gt;This contains the list of active student numbers:&lt;/P&gt;
&lt;P&gt;index=main host=main source=students&amp;nbsp; sourcetype=db_students STUDENTNUMBER&lt;/P&gt;
&lt;P&gt;And this contains all (inactive and active) student numbers and their scores.&lt;BR /&gt;&lt;BR /&gt;index=main host=main source=scores sourcetype=db_scores&lt;BR /&gt;| dedup STUDENTID&lt;BR /&gt;| eval scoreRange=case(SCORE &amp;gt;= 90, "A",&lt;BR /&gt;SCORE &amp;gt;= 80 AND CREDIT_SCORE &amp;lt;= 89, "B",&lt;BR /&gt;SCORE &amp;gt;= 70 AND CREDIT_SCORE &amp;lt;= 79, "C",&lt;BR /&gt;SCORE &amp;gt;= 60 AND CREDIT_SCORE &amp;lt;= 69, "D",&lt;BR /&gt;SCORE &amp;gt;= 0 AND CREDIT_SCORE &amp;lt;= 59, "F"&lt;BR /&gt;)&lt;BR /&gt;| stats count(STUDENTID) by scoreRange&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Don't know how to join the above to get the counts from active students (STUDENT table) only and don't know how to tell that if there's no score in the SCORES table, to give me "No Score".&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;I'd really appreciate any hints you can give me, I believe it may need tweaks because it needs to be more efficient and perhaps I don't need to use CASE.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Much appreciated!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Diana&lt;/P&gt;</description>
      <pubDate>Fri, 20 May 2022 22:52:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-getting-count-by-letter-grade-based-on-score-range/m-p/598738#M208486</guid>
      <dc:creator>Diana_a</dc:creator>
      <dc:date>2022-05-20T22:52:43Z</dc:date>
    </item>
    <item>
      <title>Re: Help getting count by letter grade based on score range</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-getting-count-by-letter-grade-based-on-score-range/m-p/598756#M208494</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/246034"&gt;@Diana_a&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;about the first question,&amp;nbsp;&amp;nbsp;you should try to use the evenstats command before the stats, remembering to add the result of evenstats to the stats, something like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=main host=main source=scores sourcetype=db_scores
| eval scoreRange=case(SCORE &amp;gt;= 90,"A", SCORE &amp;gt;= 80 AND CREDIT_SCORE &amp;lt;= 89,"B", SCORE &amp;gt;= 70 AND CREDIT_SCORE &amp;lt;= 79,"C", SCORE &amp;gt;= 60 AND CREDIT_SCORE &amp;lt;= 69,"D", SCORE &amp;gt;= 0 AND CREDIT_SCORE &amp;lt;= 59, "F")
| evenstats dc(STUDENT_ID) AS STUDENT_COUNT
| stats count(STUDENTID) AS students values(STUDENT_COUNT) AS STUDENT_COUNT BY scoreRange&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 21 May 2022 05:57:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-getting-count-by-letter-grade-based-on-score-range/m-p/598756#M208494</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2022-05-21T05:57:34Z</dc:date>
    </item>
    <item>
      <title>Re: Help getting count by letter grade based on score range</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-getting-count-by-letter-grade-based-on-score-range/m-p/598758#M208495</link>
      <description>&lt;P&gt;Can you share some sample events from your student and scores sources?&lt;/P&gt;&lt;P&gt;Is SCORE and CREDIT_SCORE the same thing?&lt;/P&gt;&lt;P&gt;Which field tells you if the student is active?&lt;/P&gt;&lt;P&gt;Your calculations are different between the SQL and SPL for grade F and consequently "no score" - was this deliberate?&lt;/P&gt;</description>
      <pubDate>Sat, 21 May 2022 06:45:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-getting-count-by-letter-grade-based-on-score-range/m-p/598758#M208495</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-05-21T06:45:48Z</dc:date>
    </item>
    <item>
      <title>Re: Help getting count by letter grade based on score range</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-getting-count-by-letter-grade-based-on-score-range/m-p/598927#M208523</link>
      <description>&lt;P&gt;I see, thank you for the tip! I am using it to check&lt;/P&gt;</description>
      <pubDate>Mon, 23 May 2022 15:45:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-getting-count-by-letter-grade-based-on-score-range/m-p/598927#M208523</guid>
      <dc:creator>Diana_a</dc:creator>
      <dc:date>2022-05-23T15:45:45Z</dc:date>
    </item>
    <item>
      <title>Re: Help getting count by letter grade based on score range</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-getting-count-by-letter-grade-based-on-score-range/m-p/599015#M208558</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/246034"&gt;@Diana_a&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;good for you, see next time!&lt;/P&gt;&lt;P&gt;please accept one answer for the other people of Community.&lt;/P&gt;&lt;P&gt;Ciao and happy splunking&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;&lt;P&gt;P.S.: Karma Points are appreciated by all the Contributors&lt;SPAN&gt;&amp;nbsp; &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 24 May 2022 06:34:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-getting-count-by-letter-grade-based-on-score-range/m-p/599015#M208558</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2022-05-24T06:34:36Z</dc:date>
    </item>
    <item>
      <title>Re: Help getting count by letter grade based on score range</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-getting-count-by-letter-grade-based-on-score-range/m-p/633676#M220100</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/246034"&gt;@Diana_a&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;good for you, see next time!&lt;/P&gt;&lt;P&gt;Ciao and happy splunking&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;&lt;P&gt;P.S.: Karma Points are appreciated by all the contributors &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Mar 2023 07:01:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-getting-count-by-letter-grade-based-on-score-range/m-p/633676#M220100</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2023-03-08T07:01:44Z</dc:date>
    </item>
  </channel>
</rss>

