Format a Number into a Percentage
I have a JSON file that has a nice number in it...
last_percentage: 0.0056
I'm trying to figure out how to format this to a percentage 5.6%
So I can get that into a dashboard.
-
Official comment
try this:
format("%.1f %s", last_percentage*100,"%") as last_percentage
that's modified from sample here: https://help.sumologic.com/05Search/Search-Query-Language/Search-Operators/format#Format_a_single_value_with_a_symbol.2C_like_percent.2C_at_the_end
i think though .0056 would be 0.56% not 5.6% - if your source really is x/10000 change the multiplier from 100. you can also change number of digits by changing .1f to .2f, etc.Comment actions
Please sign in to leave a comment.
Comments
2 comments