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!

Stay Connected: Your Guide to July Tech Talks, Office Hours, and Webinars!

What are Community Office Hours?Community Office Hours is an interactive 60-minute Zoom series where ...

Updated Data Type Articles, Anniversary Celebrations, and More on Splunk Lantern

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

A Prelude to .conf25: Your Guide to Splunk University

Heading to Boston this September for .conf25? Get a jumpstart by arriving a few days early for Splunk ...