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
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Event Series: Splunk Observability Metrics Cost Optimization

Balancing Scale and Spend: Gaining Control Over High-Volume Metrics in Splunk Observability Cloud As ...

Kick the Tires Before You Commit: A Hands-On Tour of the Splunk Observability Cloud ...

Evaluating an enterprise observability platform usually goes like this: fill out a form, get a free trial with ...

Deep insights, no barriers: Splunk Observability Cloud Free Edition

As software delivery cycles continue to accelerate, observability shouldn’t be a luxury — it should be a ...