Splunk Search

How to add a + or - sign before percent?

jip31
Motivator

hi

i add a + or a - sign before a percent result like this

 

| eval perc=if(s<2,"-","+").round((s/2)*100,1). "% " 

 

 But I need to substract 100 to the percentage result like below

 

| eval perc=if(sam<sam2,"-","+").round(100-(sam/sam2)*100,1). "% " 

 

but when I do this, I have + and - before the percent result

jip31_0-1651835574053.png

 

how to avoid this please?

 

Labels (1)
Tags (1)
0 Karma
1 Solution

isoutamo
SplunkTrust
SplunkTrust

You can use function abs like

| eval perc=if(sam<sam2,"-","+").abs(round(100-(sam/sam2)*100,1)). "% " 

r. Ismo 

View solution in original post

0 Karma

isoutamo
SplunkTrust
SplunkTrust

You can use function abs like

| eval perc=if(sam<sam2,"-","+").abs(round(100-(sam/sam2)*100,1)). "% " 

r. Ismo 

0 Karma
Get Updates on the Splunk Community!

Updated Team Landing Page in Splunk Observability

We’re making some changes to the team landing page in Splunk Observability, based on your feedback. The ...

New! Splunk Observability Search Enhancements for Splunk APM Services/Traces and ...

Regardless of where you are in Splunk Observability, you can search for relevant APM targets including service ...

Webinar Recap | Revolutionizing IT Operations: The Transformative Power of AI and ML ...

The Transformative Power of AI and ML in Enhancing Observability   In the realm of IT operations, the ...