I am working on a single value dashboard panel where I am showing output in percentage with precision up to 2 decimal points (e.g. 60.25%). However, I want shows 0 and 100 as a whole number (NO decimal point precision for these two). Please advise whether it is possible.
i think this might work for you, you'll have to code it into the SPL, not the formatting.
...|eval interestingField=if(numerator/denominator*100=0 OR numerator/denominator*100=100, numerator/denominator*100, round(numerator/denominator*100,2))
Try this, assuming X is your single value field :
| eval x=if(floor(x)=x,floor(x),x)
| where x!=0
| eval x=x." %"
| fields _time,x
Based and checked my solution on this excellent entry - https://answers.splunk.com/answers/443308/how-to-round-values-to-2-decimal-places-but-only-f.html
Checked for 0 and with decimal, the solution works.
Set your number format to 0.00 in the single value visualization
I think I should have been more clear with my question. I want to show all values except 0 & 100 with precision up to 2 decimal points (e.g. 60.25%); and I want to show 0 & 100 as a whole number. Any advice on this please.