Dashboards & Visualizations

result combination

lostcauz3
Path Finder
ORGMonthKPI_1KPI_2KPI_3KPI_4
firstSep21100NANANA
firstSep21NA100NANA
firstSep21NANA100NA
firstSep21NANANA100


how do i convert the table above  to get  the table below:

ORGMonthKPI_1KPI_2KPI_3KPI_4
firstSep21100100100100
Labels (1)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust
| foreach KPI_*
  [| eval <<FIELD>>=if(<<FIELD>>="NA",null(),<<FIELD>>)]
| stats values(*) as * by ORG Month

View solution in original post

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust
| foreach KPI_*
  [| eval <<FIELD>>=if(<<FIELD>>="NA",null(),<<FIELD>>)]
| stats values(*) as * by ORG Month
0 Karma

lostcauz3
Path Finder

thanks for the suggestion this is working but there is something with my data that i am missing i guess that's why extra "NA" is being added to the fields containing 100.

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

You could something like instead

| eval <<FIELD>>=if(match(<<FIELD>>,"NA"),null(),<<FIELD>>)

but at the end of the day, you have access to your data and can find out what's really going on.

0 Karma

lostcauz3
Path Finder
ORGMonthKPI_1KPI_2KPI_3KP_4
firstSep21100
NA
100
NA
100
NA
100
NA

 

output is coming like this for the above query you mentioned

0 Karma

lostcauz3
Path Finder

this is happening after stats values(*) as * by ORG,MONTH.

any way i can delete the multivalues of these fields that is NA @ITWhisperer 

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Anything that is NA should have been set to null() by the foreach command, so anything that is left should not be NA but somehow something else. You need to examine these more closely to figure out why they are not being set to null(). For example, is there a trailing space? or is it N/A? etc.

0 Karma

lostcauz3
Path Finder

thanks a ton,

Solved it!

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Here is a runanywhere example showing it working

| makeresults
| eval _raw="ORG	Month	KPI_1	KPI_2	KPI_3	KPI_4
first	Sep21	100	NA	NA	NA
first	Sep21	NA	100	NA	NA
first	Sep21	NA	NA	100	NA
first	Sep21	NA	NA	NA	100"
| multikv forceheader=1
| table ORG Month KPI*
| foreach KPI*
    [| eval <<FIELD>>=if(<<FIELD>>="NA",null(),<<FIELD>>)]
| stats values(*) as * by ORG Month

This probably means your real data does not match your example data closely enough.

0 Karma
Get Updates on the Splunk Community!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...