Splunk Search

Counting percentage with completion and not completed status

k31453
Explorer

Hi, I have following data:

k31453_0-1619137770961.png


And I am trying to create SPL which gets me following result:

k31453_1-1619137816420.png


I tried eventstate and stats command but not getting where i wanted.

Labels (2)
0 Karma

venkatasri
SplunkTrust
SplunkTrust

 

Hi @k31453 

Following query would help!

index="<your_index>" sourcetype="<sourcetype>" 
| stats count(user) as "Total_Customer", count(eval(all_flag_updated=="yes")) as "updated_flag" , count(eval(all_flag_updated=="no")) as "not_updated_flag" by region 
| eval updated_flag_perc = (updated_flag/Total_Customer) * 100, no_updated_flag_perc = (not_updated_flag/Total_Customer) * 100 
| table Total_Customer updated_flag not_updated_flag updated_flag_perc no_updated_flag_perc region

-------------------------------------------------

An upvote would be appreciated if it helps!

 

0 Karma
Get Updates on the Splunk Community!

Your Guide to SPL2 at .conf24!

So, you’re headed to .conf24? You’re in for a good time. Las Vegas weather is just *chef’s kiss* beautiful in ...

Get ready to show some Splunk Certification swagger at .conf24!

Dive into the deep end of data by earning a Splunk Certification at .conf24. We're enticing you again this ...

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Now On-Demand Join us to learn more about how you can leverage Service Level Objectives (SLOs) and the new ...