How to convert decimal to percentage in saql?

enter image description here


2 Answers 2


There are two ways to do that:

1. AT SAQL Level: Just round the row value to two decimal points using round(sum(....), 2) and show that column label as Midperf (in %) to make it clear that this column in showing value in percentage.

2. Change the format of field as Percentage at Dataset level::

  1. Go to --> Data Manager --> Data --> Open dataset detail page and click on explore as lens.
    1. Change the field format as percentage as below enter image description here

Ayub's answer is pretty solid. I ran into the case, however, where I needed to explicitly display the measure values as %, as opposed to shifting the decimal and stating it in the column header.

Similar to Ayub's 2nd method one would change the field format. In the edge case of running the calculation in a Lens you won't see the derived fields in the Field List. Instead you need define a new derived field.

You can do this by executing the following;

  1. Once you've got your SAQL working, click over to the chart section. This shouldn't mess with you SAQL and will give you the option to access the Field List.
  2. Click on the "Fields" right above the Filters tab on the left side.
  3. Scroll to the bottom and find the "Derived Measures" section.
  4. Click "+ Add Derived Measure"
  5. Paste in whatever you ended up naming the field you want formatted (I would recommend using a unique and descriptive name, since that's what it will appear as.)
  6. Hover over the newly added derived field and click the downward-facing arrow.
  7. Select your number format
  8. Hit Save.

You're Done!

enter image description here enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .