Splunk Search

How to format as percent with 2 decimal places and no rounding?

mbtsoltis
Explorer

How do you convert .34999832 to 34.99% or .399345 to 39.99%

I need to see the .99 and not have it round up

 

Labels (1)
0 Karma

woodcock
Esteemed Legend

You have many options:
1: round() <-you dislike this
2: replace()
3: ciel()
4: floor()
5: substr()
6: rex

0 Karma

Varnae
Loves-to-Learn Everything

We use the below to show free disk space on a drive.
eval MBs=round(b/1024/1024,2)
the 2 at the end will tell it how many decimals to carry it out.

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @mbtsoltis,

you can use eval and round, please try something like this:

| eval your_field=round(your_field*100,2)

if Splunk doesn't recognize a number, you can use the tonumber function:

| eval your_field=to_number(round(your_field*100,2))

Ciao.

Giuseppe

Get Updates on the Splunk Community!

Index This | Why did the turkey cross the road?

November 2025 Edition  Hayyy Splunk Education Enthusiasts and the Eternally Curious!   We’re back with this ...

Enter the Agentic Era with Splunk AI Assistant for SPL 1.4

  &#x1f680; Your data just got a serious AI upgrade — are you ready? Say hello to the Agentic Era with the ...

Feel the Splunk Love: Real Stories from Real Customers

Hello Splunk Community,    What’s the best part of hearing how our customers use Splunk? Easy: the positive ...