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!

Splunk AI Assistant for SPL | Key Use Cases to Unlock the Power of SPL

Splunk AI Assistant for SPL | Key Use Cases to Unlock the Power of SPL  The Splunk AI Assistant for SPL ...

Buttercup Games: Further Dashboarding Techniques (Part 5)

This series of blogs assumes you have already completed the Splunk Enterprise Search Tutorial as it uses the ...

Customers Increasingly Choose Splunk for Observability

For the second year in a row, Splunk was recognized as a Leader in the 2024 Gartner® Magic Quadrant™ for ...