Dashboards & Visualizations

Calculate completion% for a specific field in a table and display it under the same field

maverick27
Explorer

Hi Splunk Gurus, @ITWhisperer 

I need your expertise in solving a rather simple issue which is taking lot more hours for me to solve. I'm trying to create a table in Splunk which should display Grand Total under each row and also display Compleion% under "Completed" field. I'm able to achieve the grand total using addcoltotals. However, I'm unable to display the completion% under "Completed" field.

Here is how the table should look like:

 Name  Remaining  Completed 
 Alice 2518
 Bob 6342
 Claire 107
 David 4530
 Emma 8065
Grand Total:223162
Completion% 42.07%

percetnage calculation = 162/(223+162)*100

I tried using eval function to calculate the percentage but it calculates for each row in a new field. Can you please help me out? Many thanks. Much appreciated!

Labels (2)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust
| appendpipe
    [| eval Completed=if(Name="Grand Total:",100*Completed/(Completed + Remaining), null())
    | eval Remaining=null()
    | eval Name=if(Name="Grand Total:","Completion%",null())
    | where isnotnull(Name)]

View solution in original post

ITWhisperer
SplunkTrust
SplunkTrust
| appendpipe
    [| eval Completed=if(Name="Grand Total:",100*Completed/(Completed + Remaining), null())
    | eval Remaining=null()
    | eval Name=if(Name="Grand Total:","Completion%",null())
    | where isnotnull(Name)]

maverick27
Explorer

@ITWhisperer Thank you for the quick revert. It worked! 🙂

0 Karma
Get Updates on the Splunk Community!

.conf24 | Day 0

Hello Splunk Community! My name is Chris, and I'm based in Canberra, Australia's capital, and I travelled for ...

Enhance Security Visibility with Splunk Enterprise Security 7.1 through Threat ...

(view in My Videos)Struggling with alert fatigue, lack of context, and prioritization around security ...

Troubleshooting the OpenTelemetry Collector

  In this tech talk, you’ll learn how to troubleshoot the OpenTelemetry collector - from checking the ...