Rounding Number on Dashboard widgets?

Hi Team,

How could I go about rounding a number on a dashboard widget?

Cheers,
Mason

Hi @masonb81,

How are you getting this value? Is it stored in a field in an incoming message? Are you calculating it and then creating a new field?

Hi, its the average value over a period of time of another number field so the average wont be a whole number, just hoping to round this to remove the decimal places.

Hey @masonb81 ,

Where is the math occurring? I assume it’s not pre-ingest because you could just round before shipping, so is it happening in a pipeline rule? Or in the dashboard?

If it’s happening in a pipeline rule you might be able to use split (not exactly rounding…) and create a string field parsed on the decimal. If it’s happening on the dashboard, I don’t think you can do anything.

Alternatively, if you aren’t terribly concerned with precision you could use a custom index mapping to force the relevant fields to an integer data type so that when Elasticsearch ingests them they’ll be converted into integers. Then you can just do the math based on those, since presumably (I haven’t tested…) the integer data type will be preserved in the average calculation. If you do use a custom index mapping you’ll have to rotate the relevant active index before the data will start storing as integer instead of double.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.