# Get the percentage of the Dataset Column using Script Transform

**URL:** <https://forum.inductiveautomation.com/t/get-the-percentage-of-the-dataset-column-using-script-transform/84246>\
**Category:** Ignition\
**Tags:** ignition81, perspective\
**Created:** [January 13, 2024, 6:40pm UTC](https://forum.inductiveautomation.com/t/get-the-percentage-of-the-dataset-column-using-script-transform/84246 "2024-01-13T18:40:43Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [January 13, 2024, 8:03pm UTC](https://forum.inductiveautomation.com/t/get-the-percentage-of-the-dataset-column-using-script-transform/84246/4 "2024-01-13T20:03:27Z")

</div>

Your numberFormat function doesn't work and if it did it wouldn't do anything because you haven't assigned it to anything (with an `=` operator).

Try this:

```auto
sum = value[0][1] / val
return "{:.2%}".format(sum)

```

Or simplify it down to one line:

```auto
return "{:.2%}".format(value[0][1] / val)

```

The funky Python notation tells it to format with 2 digits after the decimal point and show as a percentage. It will then automatically multiply by 100 for you.

Tips:  
Post code - not pictures of code (unless you need to show the context of the code). See [Wiki - how to post code on this forum](https://forum.inductiveautomation.com/t/wiki-how-to-post-code-on-this-forum/77831).  
Leave a little air in your expressions. So, compare,  
`sum = (value[0][1]/val)*100`  
`sum = (value[0][1] / val) * 100`  
It's a personal preference but I consider the mathematical operators as separate words and so should have a space each side.

---

_[View the full topic](https://forum.inductiveautomation.com/t/get-the-percentage-of-the-dataset-column-using-script-transform/84246)._
