Archive

Issue in Splunk round function

Communicator

Hi

I have a timechart where I am displaying 4 values as a percent. My search query is like this:

.......| eval Percent1=Count1*100/(Count1+Count2+Count3+Count4)  | eval Percent2=Count2*100/(Count1+Count2+Count3+Count4)  | eval Percent3=Count3*100/(Count1+Count2+Count3+Count4)  | eval Percent4=Count4*100/(Count1+Count2+Count3+Count4)  | timechart partial=false span=1h first(Percent1) as Percent1 first(Percent2) as Percent2 first(Percent3) as Percent3 first(Percent4) as Percent4 

I am using stacked area chart to display these values. Ideally, the total of all the Percent values should be 100. But I am getting 100.000001 or 99.999999 as the total. I tried rounding the values to two decimal places but 100.000001 is rounded off to 100.01 and 99.999999 is getting rounded off to 99.99. Can anyone tell me why this happens? How do I overcome this?

Thanks in Advance

Tags (1)
0 Karma

Ultra Champion
0 Karma

Communicator

Hi. Thanks for your help. But I am still facing the same issue.

0 Karma
State of Splunk Careers

Access the Splunk Careers Report to see real data that shows how Splunk mastery increases your value and job satisfaction.

Find out what your skills are worth!