<?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 How to edit my search to display the percentage of tickets sold based on a conditional search string? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-display-the-percentage-of-tickets-sold/m-p/283143#M85540</link>
    <description>&lt;P&gt;Splunk newbie here so please bear with me.&lt;BR /&gt;
Given the table/records below, how can I build a bar chart with the percent of tickets sold based on a search string?&lt;BR /&gt;
For instance, if string = "Metallica" then sum up 3 + 1 = 4 and calculate the percentage of 10 sold tickets total.&lt;BR /&gt;
For instance, if string = "Metallica Cover" then 1 is the total and calculate the percentage of 10 total.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Tickets           Sold

Metallica           3
Metallica Cover      1
U2                 1
Soundgarden       1
Britney Spears     0
U2                 2
Metallica           2
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I managed to count the number of entries of each Ticket but what I need is to calculate the number of tickets sold, so the query below is wrong:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; | eval tickets=Tickets | replace
 *Metallica* with "Metallica", *Metallica*Cover* with "Metallica Cover", *U2* with "U2", *Soundgarden*
 with Soundgarden, *Britney*Spears*
 with "Britney Spears" in tickets | top
 limit=15 useother=t tickets
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I could also use the following =&amp;gt; stats count by tickets&lt;BR /&gt;
but I need to be able to count the num Sold by searching a specific string.&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
    <pubDate>Fri, 16 Dec 2016 15:03:05 GMT</pubDate>
    <dc:creator>maximusdm</dc:creator>
    <dc:date>2016-12-16T15:03:05Z</dc:date>
    <item>
      <title>How to edit my search to display the percentage of tickets sold based on a conditional search string?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-display-the-percentage-of-tickets-sold/m-p/283143#M85540</link>
      <description>&lt;P&gt;Splunk newbie here so please bear with me.&lt;BR /&gt;
Given the table/records below, how can I build a bar chart with the percent of tickets sold based on a search string?&lt;BR /&gt;
For instance, if string = "Metallica" then sum up 3 + 1 = 4 and calculate the percentage of 10 sold tickets total.&lt;BR /&gt;
For instance, if string = "Metallica Cover" then 1 is the total and calculate the percentage of 10 total.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Tickets           Sold

Metallica           3
Metallica Cover      1
U2                 1
Soundgarden       1
Britney Spears     0
U2                 2
Metallica           2
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I managed to count the number of entries of each Ticket but what I need is to calculate the number of tickets sold, so the query below is wrong:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; | eval tickets=Tickets | replace
 *Metallica* with "Metallica", *Metallica*Cover* with "Metallica Cover", *U2* with "U2", *Soundgarden*
 with Soundgarden, *Britney*Spears*
 with "Britney Spears" in tickets | top
 limit=15 useother=t tickets
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I could also use the following =&amp;gt; stats count by tickets&lt;BR /&gt;
but I need to be able to count the num Sold by searching a specific string.&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Fri, 16 Dec 2016 15:03:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-display-the-percentage-of-tickets-sold/m-p/283143#M85540</guid>
      <dc:creator>maximusdm</dc:creator>
      <dc:date>2016-12-16T15:03:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my search to display the percentage of tickets sold based on a conditional search string?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-display-the-percentage-of-tickets-sold/m-p/283144#M85541</link>
      <description>&lt;P&gt;Try something like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;..| eval tickets=Tickets | replace *Metallica* with "Metallica", *Metallica*Cover* with "Metallica Cover", *U2* with "U2", *Soundgarden* with Soundgarden, *Britney*Spears* with "Britney Spears" in tickets 
| stats sum(Sold) as Sold by tickets | eventstats sum(Sold) as TotalSold
| eval Percentage=round(Sold*100/TotalSold,2)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 16 Dec 2016 17:01:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-display-the-percentage-of-tickets-sold/m-p/283144#M85541</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-12-16T17:01:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my search to display the percentage of tickets sold based on a conditional search string?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-display-the-percentage-of-tickets-sold/m-p/283145#M85542</link>
      <description>&lt;P&gt;That actually worked. I was comparing the data with an Excel spreadsheet and Splunk had a filter. All good. Thank you so much!&lt;/P&gt;</description>
      <pubDate>Fri, 16 Dec 2016 20:33:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-display-the-percentage-of-tickets-sold/m-p/283145#M85542</guid>
      <dc:creator>maximusdm</dc:creator>
      <dc:date>2016-12-16T20:33:21Z</dc:date>
    </item>
  </channel>
</rss>

