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 is broken 80% of the time by February?

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

Unlock Faster Time-to-Value on Edge and Ingest Processor with New SPL2 Pipeline ...

Hello Splunk Community,   We're thrilled to share an exciting update that will help you manage your data more ...

Splunk MCP & Agentic AI: Machine Data Without Limits

Discover how the Splunk Model Context Protocol (MCP) Server can revolutionize the way your organization uses ...