<?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 create a pivot table in a dashboard from a search in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-create-a-pivot-table-in-a-dashboard-from-a-search/m-p/631094#M51743</link>
    <description>&lt;P&gt;Please take and post a screenshot of the data you can see immediately after your initial SPL example code in your first post showing what the first few lines of the table are.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 15 Feb 2023 23:08:33 GMT</pubDate>
    <dc:creator>bowesmana</dc:creator>
    <dc:date>2023-02-15T23:08:33Z</dc:date>
    <item>
      <title>How to create a pivot table in a dashboard from a search?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-create-a-pivot-table-in-a-dashboard-from-a-search/m-p/630886#M51727</link>
      <description>&lt;P&gt;I have a dashboard with this query:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;| dbxquery connection=abcd-local query="SELECT DATE_FORMAT(date(dts),GET_FORMAT(DATE,'USA')) as rate_date, category_id, count(*) FROM url_directory WHERE category_id in (1,2,3) and dts &amp;gt;= now() - INTERVAL 1 MONTH group by rate_date, category_id" | eval category_id = case(
category_id=="1", "Scam",
category_id=="2", "Phishing",
category_id=="3", "Malicious",
1==1, category_id)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It returns a table like this:&lt;/P&gt;
&lt;P&gt;Scam 5 2/1/2023&lt;BR /&gt;Phishing 18 2/1/2023&lt;BR /&gt;Malicious 23 2/1/2023&lt;BR /&gt;Scam 8 2/2/2023&lt;BR /&gt;Phishing 12 2/2/2023&lt;BR /&gt;Malicious 17 2/2/2023&lt;/P&gt;
&lt;P&gt;I want to turn that table into a Pivot Table like this:&lt;/P&gt;
&lt;P&gt;Scam Phishing Malicious&lt;BR /&gt;2/1/2023 5 18 23&lt;BR /&gt;2/2/2023 8 12 17&lt;BR /&gt;...&lt;/P&gt;
&lt;P&gt;What can I add to the query (or how can I change the query) to create that pivot table in a dashboard?&lt;/P&gt;
&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 15 Feb 2023 20:52:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-create-a-pivot-table-in-a-dashboard-from-a-search/m-p/630886#M51727</guid>
      <dc:creator>DLT76</dc:creator>
      <dc:date>2023-02-15T20:52:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a pivot table in a dashboard from a search</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-create-a-pivot-table-in-a-dashboard-from-a-search/m-p/630888#M51728</link>
      <description>&lt;P&gt;Use chart&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| chart sum(count) as count over rate_date by category_id&lt;/LI-CODE&gt;&lt;P&gt;Then if you want to rearrange your columns, use the table command&lt;/P&gt;</description>
      <pubDate>Tue, 14 Feb 2023 23:50:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-create-a-pivot-table-in-a-dashboard-from-a-search/m-p/630888#M51728</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2023-02-14T23:50:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a pivot table in a dashboard from a search</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-create-a-pivot-table-in-a-dashboard-from-a-search/m-p/630892#M51730</link>
      <description>&lt;P&gt;&lt;SPAN&gt;When I append that string to the end of my query, it returns "No results found." pretty quickly.&amp;nbsp; When I remove it, I get data.&amp;nbsp; Any ideas?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thank you for your help.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Feb 2023 00:15:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-create-a-pivot-table-in-a-dashboard-from-a-search/m-p/630892#M51730</guid>
      <dc:creator>DLT76</dc:creator>
      <dc:date>2023-02-15T00:15:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a pivot table in a dashboard from a search</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-create-a-pivot-table-in-a-dashboard-from-a-search/m-p/630894#M51731</link>
      <description>&lt;P&gt;Can you show your splunk table with that data. I assumed from your SQL/SPL that you have 3 fields&lt;/P&gt;&lt;P&gt;count, rate_date, category_id&lt;/P&gt;&lt;P&gt;If you don't have those fields, you need to tailor the chart accordingly&lt;/P&gt;</description>
      <pubDate>Wed, 15 Feb 2023 02:03:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-create-a-pivot-table-in-a-dashboard-from-a-search/m-p/630894#M51731</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2023-02-15T02:03:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a pivot table in a dashboard from a search</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-create-a-pivot-table-in-a-dashboard-from-a-search/m-p/631039#M51738</link>
      <description>&lt;P&gt;These are the fields in the table:&lt;/P&gt;&lt;P&gt;auto_cascade&lt;BR /&gt;buff_status&lt;BR /&gt;category_id&lt;BR /&gt;directory&lt;BR /&gt;domain&lt;BR /&gt;dts&lt;BR /&gt;norateflag&lt;BR /&gt;port&lt;BR /&gt;regex_unrated_value&lt;BR /&gt;regexid&lt;BR /&gt;review_later&lt;BR /&gt;root_domain_id&lt;BR /&gt;source&lt;BR /&gt;type&lt;BR /&gt;url&lt;/P&gt;&lt;P&gt;Thanks so much!&lt;/P&gt;</description>
      <pubDate>Wed, 15 Feb 2023 19:24:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-create-a-pivot-table-in-a-dashboard-from-a-search/m-p/631039#M51738</guid>
      <dc:creator>DLT76</dc:creator>
      <dc:date>2023-02-15T19:24:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a pivot table in a dashboard from a search</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-create-a-pivot-table-in-a-dashboard-from-a-search/m-p/631081#M51739</link>
      <description>&lt;P&gt;So when you are doing&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| dbxquery connection=abcd-local query="SELECT DATE_FORMAT(date(dts),GET_FORMAT(DATE,'USA')) as rate_date, category_id, count(*) FROM url_directory WHERE category_id in (1,2,3) and dts &amp;gt;= now() - INTERVAL 1 MONTH group by rate_date, category_id" &lt;/LI-CODE&gt;&lt;P&gt;the field that is showing as "2/1/2023" - what is that? In the above, I assume it's rate date, but you don't list that field in your list of fields and your data example only shows 3 bits of information, e.g.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Scam 5 2/1/2023&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;so something's not right - what is the name of the field in your data that corresponds to &lt;STRONG&gt;2/1/2023&lt;/STRONG&gt; from the list of fields you posted?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Feb 2023 22:09:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-create-a-pivot-table-in-a-dashboard-from-a-search/m-p/631081#M51739</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2023-02-15T22:09:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a pivot table in a dashboard from a search</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-create-a-pivot-table-in-a-dashboard-from-a-search/m-p/631084#M51740</link>
      <description>&lt;P&gt;It originates from the dts field based on this part of the original query:&lt;/P&gt;&lt;PRE&gt;DATE_FORMAT(date(dts),GET_FORMAT(DATE,'USA')) as rate_date&lt;/PRE&gt;&lt;P&gt;I should have shown the example in the actual format the query displays it in:&amp;nbsp; 02.01.2023.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Feb 2023 22:22:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-create-a-pivot-table-in-a-dashboard-from-a-search/m-p/631084#M51740</guid>
      <dc:creator>DLT76</dc:creator>
      <dc:date>2023-02-15T22:22:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a pivot table in a dashboard from a search</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-create-a-pivot-table-in-a-dashboard-from-a-search/m-p/631086#M51741</link>
      <description>&lt;P&gt;In your original question you posted an example of a table containing&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Scam 5 2/1/2023&lt;BR /&gt;...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;which has 3 fields.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;My suggestion to use&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| chart sum(count) as count over rate_date by category_id&lt;/LI-CODE&gt;&lt;P&gt;is based on assuming the '5' is in a field called 'count', the "Scam" is in the field called category_id and the 2/1/2023 (or 2.1.2023) is in a field called rate_date.&lt;/P&gt;&lt;P&gt;Does your table look like this, with the column headings as shown or is it something different?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="bowesmana_0-1676500133378.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/23891i60FA5F0633273FF8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="bowesmana_0-1676500133378.png" alt="bowesmana_0-1676500133378.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;You simply need to use the names of the fields in your table in the corresponding chart command above.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Feb 2023 22:29:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-create-a-pivot-table-in-a-dashboard-from-a-search/m-p/631086#M51741</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2023-02-15T22:29:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a pivot table in a dashboard from a search</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-create-a-pivot-table-in-a-dashboard-from-a-search/m-p/631090#M51742</link>
      <description>&lt;P&gt;I think I'm not using the right words. My apologies. This is all a bit confusing. Let me start from the top with some better examples. Be aware that I might not be using the right Splunk or SQL terminology.&lt;/P&gt;&lt;P&gt;We have a database table with data that I want to display like an Excel pivot table would.&lt;/P&gt;&lt;P&gt;Here's a subset of the table with actual column names (fields?) and some sample data:&lt;/P&gt;&lt;P&gt;category_id url dts&lt;BR /&gt;1 scamurl1 2/1/2023&lt;BR /&gt;1 scamurl2 2/1/2023&lt;BR /&gt;2 phishingurl1 2/2/2023&lt;BR /&gt;2 phishingurl2 2/3/2023&lt;BR /&gt;3 maliciousurl1 2/3/2023&lt;BR /&gt;1 scamurl3 2/3/2023&lt;BR /&gt;3 maliciousurl2 2/4/2023&lt;BR /&gt;2 phishingurl3 2/4/2023&lt;BR /&gt;2 phishingurl4 2/4/2023&lt;/P&gt;&lt;P&gt;What I'd like to do is display this data in a dashboard that looks like this:&lt;/P&gt;&lt;P&gt;Date Scam Phishing Malicious&lt;BR /&gt;2/1/2023 2 0 0&lt;BR /&gt;2/2/2023 0 1 0&lt;BR /&gt;2/3/2023 1 1 1&lt;BR /&gt;2/4/2023 0 2 1&lt;/P&gt;&lt;P&gt;In other words, I want to create a pivot table that has a row for each day (going back one month) and displays a count of the URLs in each category that day. And I want that pivot table to show aliases for the category numbers at the top.&lt;/P&gt;&lt;P&gt;Is that doable? I sure appreciate your time and assistance.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Feb 2023 22:46:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-create-a-pivot-table-in-a-dashboard-from-a-search/m-p/631090#M51742</guid>
      <dc:creator>DLT76</dc:creator>
      <dc:date>2023-02-15T22:46:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a pivot table in a dashboard from a search</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-create-a-pivot-table-in-a-dashboard-from-a-search/m-p/631094#M51743</link>
      <description>&lt;P&gt;Please take and post a screenshot of the data you can see immediately after your initial SPL example code in your first post showing what the first few lines of the table are.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Feb 2023 23:08:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-create-a-pivot-table-in-a-dashboard-from-a-search/m-p/631094#M51743</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2023-02-15T23:08:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a pivot table in a dashboard from a search</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-create-a-pivot-table-in-a-dashboard-from-a-search/m-p/631096#M51744</link>
      <description>&lt;P&gt;Here you go:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="DLT76_0-1676502955368.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/23894iD6E2357916FEB3C5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="DLT76_0-1676502955368.png" alt="DLT76_0-1676502955368.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Feb 2023 23:16:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-create-a-pivot-table-in-a-dashboard-from-a-search/m-p/631096#M51744</guid>
      <dc:creator>DLT76</dc:creator>
      <dc:date>2023-02-15T23:16:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a pivot table in a dashboard from a search</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-create-a-pivot-table-in-a-dashboard-from-a-search/m-p/631101#M51745</link>
      <description>&lt;P&gt;The problem is that your field name for count is actually "count(*)" and the chart command is doing sum(count) and there is no 'count' field.&lt;/P&gt;&lt;P&gt;Unfortunately you can't have a useable field with a wildcard in it - you cannot rename it and you cannot use it in other functions, so change your count(*) to&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;.... count(*) as count ...&lt;/LI-CODE&gt;&lt;P&gt;and then use the original chart command I gave&lt;/P&gt;</description>
      <pubDate>Wed, 15 Feb 2023 23:22:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-create-a-pivot-table-in-a-dashboard-from-a-search/m-p/631101#M51745</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2023-02-15T23:22:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a pivot table in a dashboard from a search</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-create-a-pivot-table-in-a-dashboard-from-a-search/m-p/631103#M51746</link>
      <description>&lt;P&gt;That worked!&amp;nbsp; Thank you for your patience helping me diagnose the issue.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Feb 2023 23:38:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-create-a-pivot-table-in-a-dashboard-from-a-search/m-p/631103#M51746</guid>
      <dc:creator>DLT76</dc:creator>
      <dc:date>2023-02-15T23:38:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a pivot table in a dashboard from a search</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-create-a-pivot-table-in-a-dashboard-from-a-search/m-p/631105#M51747</link>
      <description>&lt;P&gt;Great, glad we got there in the end!&lt;/P&gt;</description>
      <pubDate>Thu, 16 Feb 2023 00:30:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-create-a-pivot-table-in-a-dashboard-from-a-search/m-p/631105#M51747</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2023-02-16T00:30:26Z</dc:date>
    </item>
  </channel>
</rss>

