<?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 get first non-null values in the table based upon other field values? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-first-non-null-values-in-the-table-based-upon-other/m-p/607863#M211357</link>
    <description>&lt;P&gt;I have a search that is generating the results like below. I need a search where if TAC, CellName and Date are same in 2 rows, it would remove those rows where SiteName and Address is "NULL", and if the TAC, CellName and Date are different in 2 rows, rows with "NULL" value for field SiteName and Address remains.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="phularah_0-1659423135352.png" style="width: 681px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/20806iF1366257599FBBA1/image-dimensions/681x325?v=v2" width="681" height="325" role="button" title="phularah_0-1659423135352.png" alt="phularah_0-1659423135352.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 02 Aug 2022 14:59:23 GMT</pubDate>
    <dc:creator>phularah</dc:creator>
    <dc:date>2022-08-02T14:59:23Z</dc:date>
    <item>
      <title>How to get first non-null values in the table based upon other field values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-first-non-null-values-in-the-table-based-upon-other/m-p/607863#M211357</link>
      <description>&lt;P&gt;I have a search that is generating the results like below. I need a search where if TAC, CellName and Date are same in 2 rows, it would remove those rows where SiteName and Address is "NULL", and if the TAC, CellName and Date are different in 2 rows, rows with "NULL" value for field SiteName and Address remains.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="phularah_0-1659423135352.png" style="width: 681px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/20806iF1366257599FBBA1/image-dimensions/681x325?v=v2" width="681" height="325" role="button" title="phularah_0-1659423135352.png" alt="phularah_0-1659423135352.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Aug 2022 14:59:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-first-non-null-values-in-the-table-based-upon-other/m-p/607863#M211357</guid>
      <dc:creator>phularah</dc:creator>
      <dc:date>2022-08-02T14:59:23Z</dc:date>
    </item>
    <item>
      <title>Re: Need first non-null values in the table based upon other field values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-first-non-null-values-in-the-table-based-upon-other/m-p/607888#M211364</link>
      <description>&lt;P&gt;This appears to be an incomplete problem. &amp;nbsp;I assume that "in 2 rows" means in 2 consecutive rows. &amp;nbsp;The two conditions, "same in 2 rows" and "different in 2 rows" are not mutually exclusive when looking at any given row. &amp;nbsp;What is the criteria to "pair" two rows? &amp;nbsp;For example, given the following CellName in consecutive rows where SiteName and Address are all NULL and the rest of fields are identical:&lt;/P&gt;&lt;TABLE border="1" width="14.243400127226463%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="2.0283975659229228%"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="12.215546918951844%"&gt;CellName&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="2.0283975659229228%"&gt;1&lt;/TD&gt;&lt;TD width="12.215546918951844%"&gt;A&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="2.0283975659229228%"&gt;2&lt;/TD&gt;&lt;TD width="12.215546918951844%"&gt;A&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="2.0283975659229228%"&gt;4&lt;/TD&gt;&lt;TD width="12.215546918951844%"&gt;B&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="2.0283975659229228%"&gt;5&lt;/TD&gt;&lt;TD width="12.215546918951844%"&gt;B&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;6&lt;/TD&gt;&lt;TD&gt;C&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;The only intuitive decision I can make is to remove rows 1 and 2. &amp;nbsp;What about rows 2 and 3? &amp;nbsp;What about 3 &amp;nbsp;and 4? 4 &amp;nbsp;and 5? 5 and 6?&lt;/P&gt;</description>
      <pubDate>Tue, 02 Aug 2022 08:39:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-first-non-null-values-in-the-table-based-upon-other/m-p/607888#M211364</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2022-08-02T08:39:54Z</dc:date>
    </item>
    <item>
      <title>Re: Need first non-null values in the table based upon other field values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-first-non-null-values-in-the-table-based-upon-other/m-p/607899#M211368</link>
      <description>&lt;P&gt;I have sorted the results based on Date and CellName. As can be seen CellName and Date values are same for rows 5 and 6 and same in rows 3 and 4 here, but SiteName and Address are NULL.&lt;BR /&gt;So, I don't want the rows 3 and 5.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;But, there are some cases where Date and CellName combination are different, but SiteName and Address are NULL. I want those rows in my table.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="phularah_0-1659435376391.png" style="width: 733px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/20809i9F0158AB448B0921/image-dimensions/733x132?v=v2" width="733" height="132" role="button" title="phularah_0-1659435376391.png" alt="phularah_0-1659435376391.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Aug 2022 10:20:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-first-non-null-values-in-the-table-based-upon-other/m-p/607899#M211368</guid>
      <dc:creator>phularah</dc:creator>
      <dc:date>2022-08-02T10:20:16Z</dc:date>
    </item>
    <item>
      <title>Re: Need first non-null values in the table based upon other field values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-first-non-null-values-in-the-table-based-upon-other/m-p/607917#M211373</link>
      <description>&lt;P&gt;Give this a try&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Your current search with fields TAC Date SiteID CellName SiteName Address
| stats values(SiteName) as SiteName values(Address) as Address by TAC DATE SiteID CellName
| eval SiteName=if(mvcount(SiteName)&amp;gt;1, mvfilter(NOT match(SiteName,"NULL")), SiteName)
| eval Address =if(mvcount(Address)&amp;gt;1, mvfilter(NOT match(Address,"NULL")), Address)&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 02 Aug 2022 13:05:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-first-non-null-values-in-the-table-based-upon-other/m-p/607917#M211373</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2022-08-02T13:05:10Z</dc:date>
    </item>
    <item>
      <title>Re: Need first non-null values in the table based upon other field values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-first-non-null-values-in-the-table-based-upon-other/m-p/607922#M211375</link>
      <description>&lt;P&gt;No it is not working.&lt;BR /&gt;SIteName field generally has only 2 values, either NULL or "some other value" and same goes for Address field.&lt;BR /&gt;So, mvcount() will always be greater than 1 and mvfilter() won't work.&lt;BR /&gt;&lt;BR /&gt;What I need is a condition that if a CellName for a Date is not unique and its SiteName and Address field has 2 values NULL (by fillnull value=NULL) or "some other value", the row with NULL value is removed.&lt;BR /&gt;&lt;BR /&gt;But, if CellName is unique on a Date and value for SiteName and Address fields is NULL, the row remains.&lt;BR /&gt;&lt;BR /&gt;Anyhow,&amp;nbsp; using this line (| stats values(SiteName) as SiteName values(Address) as Address by TAC DATE SiteID CellName) after my search is showing no results as expected --&amp;gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;My Search right now is --&amp;gt;&lt;BR /&gt;&lt;BR /&gt;index=abc SiteID=xyz TAC=12345&lt;BR /&gt;| eval Date=strftime(_time,"%d-%b-%y")&lt;BR /&gt;| table _time TAC Date SiteID CellName SiteName Address&lt;BR /&gt;| fillnull value=NULL SiteName Address&lt;BR /&gt;| dedup Date CellName SiteName Address&lt;BR /&gt;| sort - _time&lt;BR /&gt;| fields - _time&lt;BR /&gt;&lt;BR /&gt;I am sorting with _time here, because if month changes and I am looking at last 7 days, it would show data for 31st of previous month first, then 30th and at last 1st of current month.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Aug 2022 13:48:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-first-non-null-values-in-the-table-based-upon-other/m-p/607922#M211375</guid>
      <dc:creator>phularah</dc:creator>
      <dc:date>2022-08-02T13:48:15Z</dc:date>
    </item>
    <item>
      <title>Re: Need first non-null values in the table based upon other field values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-first-non-null-values-in-the-table-based-upon-other/m-p/607926#M211378</link>
      <description>&lt;P&gt;How about this?&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Your current search with fields TAC Date SiteID CellName SiteName Address
| eventstats count by TAC Date SiteID CellName
|  where NOT (count&amp;gt;1 AND SiteName="NULL")&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 02 Aug 2022 13:54:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-first-non-null-values-in-the-table-based-upon-other/m-p/607926#M211378</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2022-08-02T13:54:15Z</dc:date>
    </item>
    <item>
      <title>Re: Need first non-null values in the table based upon other field values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-first-non-null-values-in-the-table-based-upon-other/m-p/607932#M211380</link>
      <description>&lt;P&gt;Thank you. It worked.&lt;/P&gt;</description>
      <pubDate>Tue, 02 Aug 2022 14:10:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-first-non-null-values-in-the-table-based-upon-other/m-p/607932#M211380</guid>
      <dc:creator>phularah</dc:creator>
      <dc:date>2022-08-02T14:10:31Z</dc:date>
    </item>
  </channel>
</rss>

