Comments

4 comments

  • Avatar
    Piotr Woch

    Hello Ran!

    Please check out this page on our documentation site: https://help.sumologic.com/05Search/Search-Query-Language/Search-Operators/format

    It talks about one of the ways you can achieve what you need using format() operator.

    Please let me know if you have any further questions.

    0
    Comment actions Permalink
  • Avatar
    Kevin Keech

    Hi Ran,

    The following should round your supplied number to 2 decimal places. Where <field> contains the number you want to round and <new_field> is the name you supply to the new field that contains your rounded value. 

     

    | format("%.2f", <field>) as <new_field>
    0
    Comment actions Permalink
  • Avatar
    Ran Styr

    Hi Kevin,

    Thanks for the answer.  I do see that the number is rounded but I am getting trailing zeros.
    For example 4.59000

    Is there a way to remove the zeros after the second decimal places?
    Thanks,
    Ran

    0
    Comment actions Permalink
  • Avatar
    Ran Styr

    I Found the issue. avg returns a number with more than 2  decimal places. 
    Is there a way to format avg (when using also groups)?


    | count(name),avg(value) group by name , lines
    0
    Comment actions Permalink

Please sign in to leave a comment.