<?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 column values in a table with dynamic column names? in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-compare-column-values-in-a-table-with-dynamic-column/m-p/172733#M10686</link>
    <description>&lt;P&gt;Until a better solution arrives... Run 2 &lt;CODE&gt;join&lt;/CODE&gt; subsearches: 1 for the first day and one for the last. Then fillnulls, then get the delta, and drop the now extra fields.&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;index=summary Uniques earliest=-7d@d latest=@d+10m|&lt;/CODE&gt; &lt;BR /&gt;
&lt;CODE&gt;eval Time=strftime(_time,"%m/%d") |&lt;/CODE&gt;&lt;BR /&gt;
&lt;CODE&gt;chart last(Uniques) over GUID by Time |&lt;/CODE&gt;&lt;BR /&gt;
&lt;CODE&gt;join type=outer GUID [ search index=summary Uniques earliest=-7d@d latest=-6d@d | stats last(Uniques) as FIRSTDAY ] |&lt;/CODE&gt;&lt;BR /&gt;
&lt;CODE&gt;join type=outer GUID [ search index=summary Uniques earliest=-1d@d latest=@d | stats last(Uniques) as LASTDAY ] |&lt;/CODE&gt;&lt;BR /&gt;
&lt;CODE&gt;fillnull |&lt;/CODE&gt;&lt;BR /&gt;
&lt;CODE&gt;eval Delta=LASTDAY-FIRSTDAY |&lt;/CODE&gt;&lt;BR /&gt;
&lt;CODE&gt;fields - LASTDAY FIRSTDAY&lt;/CODE&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 06 May 2015 17:05:12 GMT</pubDate>
    <dc:creator>twinspop</dc:creator>
    <dc:date>2015-05-06T17:05:12Z</dc:date>
    <item>
      <title>How to compare column values in a table with dynamic column names?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-compare-column-values-in-a-table-with-dynamic-column/m-p/172726#M10679</link>
      <description>&lt;P&gt;alt textI've got daily searches dumping unique user counts by GUID into a summary index. My example search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=summary Uniques earliest=-7d@d latest=@d+10m| 
eval Time=strftime(_time,"%m/%d") | 
chart last(Uniques) over GUID by Time |
fillnull
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This produces a table with 7 days ("mm/dd") across the top, GUIDs down the left, and unique user counts in the cells. &lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;GUID   04/29   04/30   05/01   05/02   05/03   05/04   05/05&lt;/CODE&gt;&lt;BR /&gt;
&lt;CODE&gt;foobar   0        12       20       15       30       12       40&lt;/CODE&gt;&lt;BR /&gt;
&lt;CODE&gt;barfoo   10       11       24       11       38       22       52&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;I'd like to add a column to the far right for Delta, showing the change from the FIRST column (the earliest day) and the LAST column (the latest day).&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;GUID   04/29   04/30   05/01   05/02   05/03   05/04   05/05   Delta&lt;/CODE&gt;&lt;BR /&gt;
&lt;CODE&gt;foobar   0        12       20       15       30       12       40       40&lt;/CODE&gt;&lt;BR /&gt;
&lt;CODE&gt;barfoo   10       11       24       11       38       22       52       42&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Using &lt;CODE&gt;stats&lt;/CODE&gt; with &lt;CODE&gt;earliest()&lt;/CODE&gt; and &lt;CODE&gt;latest()&lt;/CODE&gt; earlier in the chain doesn't work because nulls are there for GUIDs that didn't exist, so the &lt;CODE&gt;eval&lt;/CODE&gt; is comparing the first non-null value, not a zero like I want. Once I fill the nulls, the table is already made and the column names are dynamic. An outer &lt;CODE&gt;join&lt;/CODE&gt; subsearch limited to the earliest days might do it? Seems like a messy solution, if it would even work. There's gotta be a better way... maybe?&lt;/P&gt;

&lt;P&gt;Thanks,&lt;BR /&gt;
Jon&lt;/P&gt;</description>
      <pubDate>Wed, 06 May 2015 01:15:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-compare-column-values-in-a-table-with-dynamic-column/m-p/172726#M10679</guid>
      <dc:creator>twinspop</dc:creator>
      <dc:date>2015-05-06T01:15:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare column values in a table with dynamic column names?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-compare-column-values-in-a-table-with-dynamic-column/m-p/172727#M10680</link>
      <description>&lt;P&gt;Can you please share the sample table generated and what additional column you want to add (i.e. the table output from above query and expected table)?&lt;/P&gt;

&lt;P&gt;Thanks!!&lt;/P&gt;</description>
      <pubDate>Wed, 06 May 2015 05:55:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-compare-column-values-in-a-table-with-dynamic-column/m-p/172727#M10680</guid>
      <dc:creator>vganjare</dc:creator>
      <dc:date>2015-05-06T05:55:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare column values in a table with dynamic column names?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-compare-column-values-in-a-table-with-dynamic-column/m-p/172728#M10681</link>
      <description>&lt;P&gt;Tried to draw some table action. Failed. See attached image of what it looks like before I hit submit.&lt;/P&gt;</description>
      <pubDate>Wed, 06 May 2015 14:02:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-compare-column-values-in-a-table-with-dynamic-column/m-p/172728#M10681</guid>
      <dc:creator>twinspop</dc:creator>
      <dc:date>2015-05-06T14:02:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare column values in a table with dynamic column names?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-compare-column-values-in-a-table-with-dynamic-column/m-p/172729#M10682</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=summary Uniques earliest=-7d@d latest=@d+10m|
stats min(_time) AS firstTime, max(_time) AS lastTime by GUID,_time |
eval Time=strftime(_time,"%m/%d") |
chart last(Uniques), first(firstTime) AS firstTime, first(lastTime) AS lastTime over GUID by Time |
eval Delta=lastTime-firstTime |
fillnull
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Or, if for some reason that does't work, this surely should:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=summary Uniques earliest=-7d@d latest=@d+10m|
eventstats min(_time) AS firstTime, max(_time) AS lastTime by GUID |
eval Time=strftime(_time,"%m/%d") | 
chart last(Uniques), first(firstTime) AS firstTime, first(lastTime) AS lastTime over GUID by Time |
eval Delta=lastTime-firstTime |
fillnull
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 06 May 2015 14:23:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-compare-column-values-in-a-table-with-dynamic-column/m-p/172729#M10682</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-05-06T14:23:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare column values in a table with dynamic column names?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-compare-column-values-in-a-table-with-dynamic-column/m-p/172730#M10683</link>
      <description>&lt;P&gt;Negative, Ghostrider. Your delta is comparing times. I want a delta of the unique user count between the first column and the last column. (And your column names end up with "firstTime:dd/mm" and "last(Uniques):dd/mm" so the &lt;CODE&gt;eval&lt;/CODE&gt; for the time-based Delta fails.)&lt;/P&gt;</description>
      <pubDate>Wed, 06 May 2015 14:41:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-compare-column-values-in-a-table-with-dynamic-column/m-p/172730#M10683</guid>
      <dc:creator>twinspop</dc:creator>
      <dc:date>2015-05-06T14:41:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare column values in a table with dynamic column names?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-compare-column-values-in-a-table-with-dynamic-column/m-p/172731#M10684</link>
      <description>&lt;P&gt;I see my mistake now; try this:&lt;/P&gt;

&lt;P&gt;index=summary Uniques earliest=-7d@d latest=@d+10m| &lt;BR /&gt;
eval Time=strftime(_time,"%m/%d") | &lt;BR /&gt;
chart last(Uniques) over GUID by Time |&lt;BR /&gt;
fillnull | rex "^(?&amp;lt;firstValue&amp;gt;[\S]+)*(?&amp;lt;lastValue&amp;gt;[\S]+)$" | eval Delta = lastValue-firstValue | fields - *Value&lt;/P&gt;</description>
      <pubDate>Wed, 06 May 2015 16:33:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-compare-column-values-in-a-table-with-dynamic-column/m-p/172731#M10684</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-05-06T16:33:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare column values in a table with dynamic column names?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-compare-column-values-in-a-table-with-dynamic-column/m-p/172732#M10685</link>
      <description>&lt;P&gt;&lt;CODE&gt;rex&lt;/CODE&gt; works on _raw by default. Once we create the chart _raw is null. So I don't think &lt;CODE&gt;rex&lt;/CODE&gt; will work. (In any case, it doesn't work as presented.) Thanks for trying tho.&lt;/P&gt;</description>
      <pubDate>Wed, 06 May 2015 16:47:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-compare-column-values-in-a-table-with-dynamic-column/m-p/172732#M10685</guid>
      <dc:creator>twinspop</dc:creator>
      <dc:date>2015-05-06T16:47:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare column values in a table with dynamic column names?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-compare-column-values-in-a-table-with-dynamic-column/m-p/172733#M10686</link>
      <description>&lt;P&gt;Until a better solution arrives... Run 2 &lt;CODE&gt;join&lt;/CODE&gt; subsearches: 1 for the first day and one for the last. Then fillnulls, then get the delta, and drop the now extra fields.&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;index=summary Uniques earliest=-7d@d latest=@d+10m|&lt;/CODE&gt; &lt;BR /&gt;
&lt;CODE&gt;eval Time=strftime(_time,"%m/%d") |&lt;/CODE&gt;&lt;BR /&gt;
&lt;CODE&gt;chart last(Uniques) over GUID by Time |&lt;/CODE&gt;&lt;BR /&gt;
&lt;CODE&gt;join type=outer GUID [ search index=summary Uniques earliest=-7d@d latest=-6d@d | stats last(Uniques) as FIRSTDAY ] |&lt;/CODE&gt;&lt;BR /&gt;
&lt;CODE&gt;join type=outer GUID [ search index=summary Uniques earliest=-1d@d latest=@d | stats last(Uniques) as LASTDAY ] |&lt;/CODE&gt;&lt;BR /&gt;
&lt;CODE&gt;fillnull |&lt;/CODE&gt;&lt;BR /&gt;
&lt;CODE&gt;eval Delta=LASTDAY-FIRSTDAY |&lt;/CODE&gt;&lt;BR /&gt;
&lt;CODE&gt;fields - LASTDAY FIRSTDAY&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 06 May 2015 17:05:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-compare-column-values-in-a-table-with-dynamic-column/m-p/172733#M10686</guid>
      <dc:creator>twinspop</dc:creator>
      <dc:date>2015-05-06T17:05:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare column values in a table with dynamic column names?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-compare-column-values-in-a-table-with-dynamic-column/m-p/172734#M10687</link>
      <description>&lt;P&gt;Try using eventstats and then piping to xyseries.  I spent some time working on and got it almost working enough to conclude that this approach should work for you.&lt;/P&gt;</description>
      <pubDate>Wed, 06 May 2015 18:50:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-compare-column-values-in-a-table-with-dynamic-column/m-p/172734#M10687</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-05-06T18:50:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare column values in a table with dynamic column names?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-compare-column-values-in-a-table-with-dynamic-column/m-p/172735#M10688</link>
      <description>&lt;P&gt;Hi Guys, it seems like it has been some time , this is little bit unorthodox (matrix) , but it works  ( i created sample data from _internal). &lt;BR /&gt;
However, my answer is not complete, there should be a better way for those evals , I couldn't  made eval{} work. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| tstats count where index=_internal sourcetype=splunkd latest=@d earliest=-8d@d by _time,host 
| bin _time span=1d 
| eval Date=strftime(_time,"%m%d") 
| chart sum(count) as count over host by Date useother=false limit=50
| fillnull
| transpose 100
| streamstats current=f window=1 last(row*) as row*_prev
| rename "row *" as row*
| eval row1_increase_percentage=if(isnum('row1') AND isnum('row1_prev'),round(('row1'-'row1_prev')/'row1_prev',2)*100,null())
| eval row2_increase_percentage=if(isnum('row2') AND isnum('row2_prev'),round(('row2'-'row2_prev')/'row2_prev',2)*100,null())
.......... 
| transpose 100
| sort column
| fields  - "row 2" 
| filldown
| search column=*increase* OR column="column"
| fields - column
| eval "row 1"=if('row 1'="host","_time",'row 1')
| transpose header_field=_time 100
| fields - column
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 11 May 2020 20:15:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-compare-column-values-in-a-table-with-dynamic-column/m-p/172735#M10688</guid>
      <dc:creator>akocak</dc:creator>
      <dc:date>2020-05-11T20:15:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare column values in a table with dynamic column names?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-compare-column-values-in-a-table-with-dynamic-column/m-p/172736#M10689</link>
      <description>&lt;P&gt;Hi @akocak&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| tstats count where index=_internal sourcetype=splunkd latest=@d earliest=-8d@d by _time span=1d host 
| eval Date=strftime(_time,"%m%d") 
| streamstats current=f last(count) as prev by host 
| eval perc=round((count-prev)/prev,2)*100 
| xyseries Date host perc
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;How about this? &lt;BR /&gt;
I only have one host, so please let me know your results.&lt;/P&gt;</description>
      <pubDate>Mon, 11 May 2020 20:54:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-compare-column-values-in-a-table-with-dynamic-column/m-p/172736#M10689</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-05-11T20:54:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare column values in a table with dynamic column names?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-compare-column-values-in-a-table-with-dynamic-column/m-p/172737#M10690</link>
      <description>&lt;P&gt;This looks good .  I may have overworked mine for internal logs.  However, my start point was dynamic number of  columns and rows&lt;/P&gt;</description>
      <pubDate>Tue, 12 May 2020 14:42:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-compare-column-values-in-a-table-with-dynamic-column/m-p/172737#M10690</guid>
      <dc:creator>akocak</dc:creator>
      <dc:date>2020-05-12T14:42:29Z</dc:date>
    </item>
  </channel>
</rss>

