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 | 25 | 18 |
Bob | 63 | 42 |
Claire | 10 | 7 |
David | 45 | 30 |
Emma | 80 | 65 |
Grand Total: | 223 | 162 |
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!
| 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)]
| 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)]
@ITWhisperer Thank you for the quick revert. It worked! 🙂