Splunk Search

Calculating Percentage

vinod743374
Communicator

vinod743374_0-1626105167460.png

i just want to calculate the Passed Percentage of every date .

i have the Passed Count as well as the Total devices.

is there any logic to calculate the % for every date Dynamically , because there are few more data to be added with a different date.

Please help me , is there any possibility to do that .

it would be appreciated,
Thank you.

Labels (3)
0 Karma
1 Solution

richgalloway
SplunkTrust
SplunkTrust

Try foreach.  It iterates over fields that match a pattern and performs specified commands on each.

| foreach Passed* [eval "Pct<<MATCHSTR>>" = '<<FIELD>>'*100/'Total<<MATCHSTR>>'
---
If this reply helps you, Karma would be appreciated.

View solution in original post

richgalloway
SplunkTrust
SplunkTrust

Try foreach.  It iterates over fields that match a pattern and performs specified commands on each.

| foreach Passed* [eval "Pct<<MATCHSTR>>" = '<<FIELD>>'*100/'Total<<MATCHSTR>>'
---
If this reply helps you, Karma would be appreciated.
Get Updates on the Splunk Community!

Index This | What’s a riddle wrapped in an enigma?

September 2025 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with this ...

BORE at .conf25

Boss Of Regular Expression (BORE) was an interactive session run again this year at .conf25 by the brilliant ...

OpenTelemetry for Legacy Apps? Yes, You Can!

This article is a follow-up to my previous article posted on the OpenTelemetry Blog, "Your Critical Legacy App ...