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!

New Year, New Changes for Splunk Certifications

As we embrace a new year, we’re making a small but important update to the Splunk Certification ...

[Puzzles] Solve, Learn, Repeat: Unmerging HTML Tables

[Puzzles] Solve, Learn, Repeat: Unmerging HTML TablesFor a previous puzzle, I needed some sample data, and ...

Enterprise Security (ES) Essentials 8.3 is Now GA — Smarter Detections, Faster ...

As of today, Enterprise Security (ES) Essentials 8.3 is now generally available, helping SOC teams simplify ...