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!

Building Reliable Asset and Identity Frameworks in Splunk ES

 Accurate asset and identity resolution is the backbone of security operations. Without it, alerts are ...

Cloud Monitoring Console - Unlocking Greater Visibility in SVC Usage Reporting

For Splunk Cloud customers, understanding and optimizing Splunk Virtual Compute (SVC) usage and resource ...

Automatic Discovery Part 3: Practical Use Cases

If you’ve enabled Automatic Discovery in your install of the Splunk Distribution of the OpenTelemetry ...