Splunk Search

How to display data value in percentage

sebastiangohhy
Engager

Hi there,
Im trying to display the data values in percentage. How can i do it?
Thanks

alt text

Tags (1)
0 Karma
1 Solution

cmerriman
Super Champion

you want Correct to be %Correct=(Correct/(Correct+Wrong)) for example?

try this:

index="cyber_wellness" sourcetype="csv"|chart count over Stage by CorrectAns
|eval %Correct=round((Correct/(Correct+Wrong))*100,2)|eval %Wrong=round((Wrong/(Correct+Wrong))*100,2)
|fields Stage %Correct %Wrong

View solution in original post

cmerriman
Super Champion

you want Correct to be %Correct=(Correct/(Correct+Wrong)) for example?

try this:

index="cyber_wellness" sourcetype="csv"|chart count over Stage by CorrectAns
|eval %Correct=round((Correct/(Correct+Wrong))*100,2)|eval %Wrong=round((Wrong/(Correct+Wrong))*100,2)
|fields Stage %Correct %Wrong

sheamus69
Communicator

You may be able to achieve this using the eventstats command.

See https://answers.splunk.com/answers/9660/stats-count-as-a-percentage-as-the-total.html for an example.

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...