<?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 compare the count of two fields from different source types ? in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-compare-the-count-of-two-fields-from-different-source/m-p/743191#M58508</link>
    <description>&lt;P&gt;Awesome&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/170906"&gt;@livehybrid&lt;/a&gt;&amp;nbsp;, Thanks&lt;/P&gt;</description>
    <pubDate>Tue, 01 Apr 2025 20:32:30 GMT</pubDate>
    <dc:creator>Ombessam</dc:creator>
    <dc:date>2025-04-01T20:32:30Z</dc:date>
    <item>
      <title>How to compare the count of two fields from different source types ?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-compare-the-count-of-two-fields-from-different-source/m-p/743176#M58506</link>
      <description>&lt;P&gt;How can I get the following visualization ?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Field1VsField2.png" style="width: 640px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/38414iD1E646A8CDDC8A79/image-size/large?v=v2&amp;amp;px=999" role="button" title="Field1VsField2.png" alt="Field1VsField2.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I've tried the following commands:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;(index="my_index" sourcetype="sourcetype1") OR (index="my_index" sourcetype="sourcetype2")
| fields field1 field2
| stats count(field1) as Field1, count(field2) as Field2&lt;/LI-CODE&gt;&lt;P&gt;and I getting the following graph&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2025-04-01 at 19.00.30.png" style="width: 999px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/38415i664758B8494A46C6/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2025-04-01 at 19.00.30.png" alt="Screenshot 2025-04-01 at 19.00.30.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Apr 2025 17:20:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-compare-the-count-of-two-fields-from-different-source/m-p/743176#M58506</guid>
      <dc:creator>Ombessam</dc:creator>
      <dc:date>2025-04-01T17:20:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare the count of two fields from different source types ?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-compare-the-count-of-two-fields-from-different-source/m-p/743184#M58507</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/276019"&gt;@Ombessam&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;To get the desired visualisation comparing the counts of field1 and field2, you need to transform the results of your stats command so that the field names become values in one column and the counts become values in another. The transpose command is suitable for this.&lt;/P&gt;&lt;PRE&gt;(index="my_index" sourcetype="sourcetype1") OR (index="my_index" sourcetype="sourcetype2")&lt;BR /&gt;| stats count(field1) as Field1, count(field2) as Field2 &lt;BR /&gt;| transpose &lt;BR /&gt;| rename column as FieldName, "row 1" as Count&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This structure (FieldName, Count) allows you to configure your bar chart visualization.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="livehybrid_0-1743537129332.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/38416iF870521DA1C37122/image-size/medium?v=v2&amp;amp;px=400" role="button" title="livehybrid_0-1743537129332.png" alt="livehybrid_0-1743537129332.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You could also achieve this with:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;(index="my_index" sourcetype="sourcetype1") OR (index="my_index" sourcetype="sourcetype2")
| eval x="x" 
| stats count(status) as field1, count(bytes) as field2 by x&lt;/LI-CODE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="livehybrid_1-1743537175169.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/38417i5BF7CBAB65182A07/image-size/medium?v=v2&amp;amp;px=400" role="button" title="livehybrid_1-1743537175169.png" alt="livehybrid_1-1743537175169.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":glowing_star:"&gt;🌟&lt;/span&gt; &lt;STRONG&gt;Did this answer help you?&lt;/STRONG&gt; If so, please consider:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Adding kudos to show it was useful&lt;/LI&gt;&lt;LI&gt;Marking it as the solution if it resolved your issue&lt;/LI&gt;&lt;LI&gt;Commenting if you need any clarification&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Your feedback encourages the volunteers in this community to continue contributing&lt;/P&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 01 Apr 2025 19:53:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-compare-the-count-of-two-fields-from-different-source/m-p/743184#M58507</guid>
      <dc:creator>livehybrid</dc:creator>
      <dc:date>2025-04-01T19:53:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare the count of two fields from different source types ?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-compare-the-count-of-two-fields-from-different-source/m-p/743191#M58508</link>
      <description>&lt;P&gt;Awesome&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/170906"&gt;@livehybrid&lt;/a&gt;&amp;nbsp;, Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 01 Apr 2025 20:32:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-compare-the-count-of-two-fields-from-different-source/m-p/743191#M58508</guid>
      <dc:creator>Ombessam</dc:creator>
      <dc:date>2025-04-01T20:32:30Z</dc:date>
    </item>
  </channel>
</rss>

