I created a table visualization in dashboard studio. Search query has large numbers. How to format that number to display millions as 1.28M i.e with letter M
Not a mini-program with eval please. Need a good function, format specifer
Perhaps this could be a solution.
How to convert a large number to string with expressions of long and short scales, or neither.
Numeral system macros for Splunk
https://splunkbase.splunk.com/app/6595
Example :
index=log-13120-nonprod-c laas_appId=qbmp.prediction-engine ("current predicted as" OR "predicted as Prediction")
| lookup freq_used_jobs_bmp_3months.csv jobname output jobname local=true
| stats count(predictionStatus) | fieldformat count=tostring(count,"commas")
This results into a large number of 163,071,022.
If we have a good function for converting into million, billion dynamically as per the result. Also a format specifier if we want the result in million or billion.
Eg above can be 163.1 M or 0.1B like that.
There is no function that does what you describe. Feel free to write one or suggest it at https://ideas.splunk.com.
You still haven't explained what you meant by "somehow this does not work" in response to my first answer.
If I get number as output, 163,282,548 then a function should be able to convert it to International units of millions, billions by a symbol = M. So the above should read as 163.3 M
There should be arguments for number of digits for rounding etc
There's no Dashboard Studio option or function that do what you ask. Consider asking for it at https://ideas.splunk.com.
In the meantime, you can get the same effect with a little more SPL. Use fieldformat to convert millions into a smaller number. Use fieldformat instead of eval to preserve the original field value.
| fieldformat value = value / 1000000
Then set these visualization options (as well as any others you need):
"options": {
"unit": "M",
"numberPrecision": 3
}
Hi,
somehow this does not work ! 😞
Tell us more, please. What results do you get? Can you share the XML for that part of the dashboard?