- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
jip31
Motivator
05-06-2022
04:13 AM
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
how to avoid this please?
1 Solution
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
isoutamo

SplunkTrust
05-06-2022
04:35 AM
You can use function abs like
| eval perc=if(sam<sam2,"-","+").abs(round(100-(sam/sam2)*100,1)). "% "
r. Ismo
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
isoutamo

SplunkTrust
05-06-2022
04:35 AM
You can use function abs like
| eval perc=if(sam<sam2,"-","+").abs(round(100-(sam/sam2)*100,1)). "% "
r. Ismo
