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!

Unlock Database Monitoring with Splunk Observability Cloud

  In today’s fast-paced digital landscape, even minor database slowdowns can disrupt user experiences and ...

Purpose in Action: How Splunk Is Helping Power an Inclusive Future for All

At Cisco, purpose isn’t a tagline—it’s a commitment. Cisco’s FY25 Purpose Report outlines how the company is ...

[Upcoming Webinar] Demo Day: Transforming IT Operations with Splunk

Join us for a live Demo Day at the Cisco Store on January 21st 10:00am - 11:00am PST In the fast-paced world ...