Splunk Search

Insert "%" symbol to a number without converting it to string

jvmerilla
Path Finder

Hi,

Is it possible to add a "%" character/symbol to a number without converting it to a string?

I tried to use this code:
| eval percentage = round((On_time/Total)*100)."%"

But it converted the number into a string, so when I try to use the "percentage" field as an overlay in a Column Chart, it does not show anything. It has to be an integer.
I want it to have the "%" character so that when I hover over the overlay, the value would have the "%" sign so that it would be easy to know that it is a percentage, not just any number.

Is this possible?

I hope anyone can help me with this.

Thank you.

0 Karma

richgalloway
SplunkTrust
SplunkTrust

By definition, a field with anything other than digits or '.' is a string. There is no way around that.
If you were using a pie chart, you could use the SimpleXML charting.chart.showPercent option to display percentages, but that is not supported by other chart types.

---
If this reply helps you, Karma would be appreciated.
0 Karma
Get Updates on the Splunk Community!

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...