<?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: Stats count on multiple fields in Reporting</title>
    <link>https://community.splunk.com/t5/Reporting/How-to-achieve-stats-count-on-multiple-fields/m-p/630376#M11810</link>
    <description>&lt;P&gt;That command is not a valid Splunk command&lt;/P&gt;&lt;P&gt;What you probably want is&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| stats dc(AssetNames) AS TotalExternalAssets
        dc(eval(if(vulnerability!="missing", AssetNames, null()))) AS TotalExposedAssets&lt;/LI-CODE&gt;&lt;P&gt;I assume the AssetNames field is the same field (not Asset_Names in the second case)&lt;/P&gt;&lt;P&gt;This takes the count of unique assets (first dc()) and the second says&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;If the vulnerability is not missing, then count AssetNames, otherwise count NULL (this counts as 0)&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 10 Feb 2023 00:47:02 GMT</pubDate>
    <dc:creator>bowesmana</dc:creator>
    <dc:date>2023-02-10T00:47:02Z</dc:date>
    <item>
      <title>How to achieve stats count on multiple fields?</title>
      <link>https://community.splunk.com/t5/Reporting/How-to-achieve-stats-count-on-multiple-fields/m-p/630365#M11809</link>
      <description>&lt;P&gt;Hi all - this one is hurting my brain. I need to pull two distinct numbers from my events: one with a total count of assets, and one with a total count of assets that contain a vulnerability.&lt;BR /&gt;&lt;BR /&gt;What I think it should look like is not working:&lt;BR /&gt;&lt;BR /&gt;&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;| (stats dc(AssetNames) AS TotalExternalAssets, (dc(Asset_Names) AS TotalExposedAssets | where vulnerability!="missing"))&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;How do I get these two counts out of my events?&lt;/P&gt;</description>
      <pubDate>Fri, 10 Feb 2023 20:31:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/How-to-achieve-stats-count-on-multiple-fields/m-p/630365#M11809</guid>
      <dc:creator>mistydennis</dc:creator>
      <dc:date>2023-02-10T20:31:04Z</dc:date>
    </item>
    <item>
      <title>Re: Stats count on multiple fields</title>
      <link>https://community.splunk.com/t5/Reporting/How-to-achieve-stats-count-on-multiple-fields/m-p/630376#M11810</link>
      <description>&lt;P&gt;That command is not a valid Splunk command&lt;/P&gt;&lt;P&gt;What you probably want is&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| stats dc(AssetNames) AS TotalExternalAssets
        dc(eval(if(vulnerability!="missing", AssetNames, null()))) AS TotalExposedAssets&lt;/LI-CODE&gt;&lt;P&gt;I assume the AssetNames field is the same field (not Asset_Names in the second case)&lt;/P&gt;&lt;P&gt;This takes the count of unique assets (first dc()) and the second says&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;If the vulnerability is not missing, then count AssetNames, otherwise count NULL (this counts as 0)&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Feb 2023 00:47:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/How-to-achieve-stats-count-on-multiple-fields/m-p/630376#M11810</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2023-02-10T00:47:02Z</dc:date>
    </item>
  </channel>
</rss>

