Dashboards & Visualizations

How to display a certain value in a single value chart when the value is not equal to zero?

mdmaala
Communicator

hi! I have a single value chart wherein I want to display a certain value if that value is not equal to zero. I have three values, BAD, WARNING GOOD. when either each of these values turns to zero I will not display it in the single value and the non zero value will be the one displayed in my single value chart.

here is my search:

| ... mysearch 
|eval RT = T + Tt
|eval Rt = R + Rr
|eval Target= Rt * 600

|eval Bad = if((RT>Target),RT,0)
|eval Warning = if((RT<=(Target-1)) AND (RT>(Target/2)),RT,0)
|eval Good = if((RT<=((Target/2)-1)),RT,0)
0 Karma

mrunals
Path Finder

I'd try a case statement. If I follow your logic it might look something like this. This way you end up with just one field and one value to then display in your single value visualization. The "fixme" at the end is just in case there is some logic issues to work out you get some result vs everything not evaluating as true.

| eval foo = case(RT>Target, "Bad", RT<=(Target-1) AND (RT>(Target/2)), "Warning", RT<=((Target/2)-1), "Good", 1=1, "fixme")
| fields foo

0 Karma

mdmaala
Communicator

I will try this then I will get back if this works for me, thank you so much!

0 Karma

somesoni2
SplunkTrust
SplunkTrust

Can you provide expected output with sample values of fields Bad/Warning/Good?

0 Karma

mdmaala
Communicator

Depending on the condition, these values can go Like this,

Good Warning Bad
0 0 100
100 0 0

as you notice, depending on the condition, only one contains a value while two values remain at zero

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...