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!

CX Day is Coming!

Customer Experience (CX) Day is on October 7th!! We're so excited to bring back another day full of wonderful ...

Strengthen Your Future: A Look Back at Splunk 10 Innovations and .conf25 Highlights!

The Big One: Splunk 10 is Here!  The moment many of you have been waiting for has arrived! We are thrilled to ...

Now Offering the AI Assistant Usage Dashboard in Cloud Monitoring Console

Today, we’re excited to announce the release of a brand new AI assistant usage dashboard in Cloud Monitoring ...