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!

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...

Get the T-shirt to Prove You Survived Splunk University Bootcamp

As if Splunk University, in Las Vegas, in-person, with three days of bootcamps and labs weren’t enough, now ...

Wondering How to Build Resiliency in the Cloud?

IT leaders are choosing Splunk Cloud as an ideal cloud transformation platform to drive business resilience,  ...