All Apps and Add-ons

how to calculate percentage for each category

hqw
Path Finder

Hi all,

i want to calculate and display percentage for each category not the records, based on below search , i can get the result of records number, but i want to display as percentage, could you pls kindly let me know how to calculate? Thanks

**|stats count as count by Q |addtotals col=t row=f labelfield="Q" label=all

result:
Q count
A 220
B 387
C 228
D 247
E 268
all 1350

0 Karma
1 Solution

hqw
Path Finder

i have fixed the problem by below search:

**| eventstats count(Q) as total |stats count as count by Q total|eval percent=round(count/total*100,2) |table Q,percent

thanks.

View solution in original post

0 Karma

hqw
Path Finder

i have fixed the problem by below search:

**| eventstats count(Q) as total |stats count as count by Q total|eval percent=round(count/total*100,2) |table Q,percent

thanks.

0 Karma
Get Updates on the Splunk Community!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...