# Pointseries isn't a number and calculating percentages

Did you know that the `pointseries`

object used to be able to cast into a number? Yeah, what? Doesn't matter, it didn't really work, so we're removing it. I figured out it didn't work because we're pulling out a confusing setting from the pie chart that would group together tiny slices, by default under 3%, into a big "Other" group. This was a function of the pie chart library we were using and was sort of confusing because it couldn't be easily styled.

If you still want that functionality, you can transform data to achieve the same effect. This leads us into a fun little tutorial on using `staticColumn`

and `mapColumn`

. Come along and ride on a fantastic voyage...

```
demodata
| pointseries color="country" size="sum(price)"
| staticColumn total value={math 'sum(size)'}
| mapColumn percent fn=${math 'size/total * 100'}
| mapColumn color
fn=${
if {getCell percent | compare lt to=3}
then=Other
else={getCell color}
}
| pointseries size="sum(percent)" color=color
| pie
```

Let's break this down. The first two lines are pretty standard, grab some data and model it:

```
demodata
| pointseries color="country" size="sum(price)"
```

From there we need to calculate percentages so we can figure out which slices are less than 3%. To get a percentage we need to know the total. `pointseries`

will cast into a `datatable`

here:

```
| staticColumn total value={math 'sum(size)'}
```

Then we need to divide each size column by that total, and multiply that number by 100

```
| mapColumn percent fn=${math 'size/total * 100'}
```

At this point, we have 2 new columns: `total`

and `percent`

. Now we need to change the `color`

property of any row in which `percent`

is less than 3. So we'll map over each row applying a conditional. That conditional will `getCell`

the value of `percent`

, and `compare`

it with `3`

, if it's less, then `color`

will be set to `Other`

, if not, we'll `getCell`

whatever is already in `color`

```
| mapColumn color
fn=${
if {getCell percent | compare lt to=3}
then=Other
else={getCell color}
}
```

Now we pipe the whole thing back into `pointseries`

, making sure to `sum(percent)`

as we now have a bunch of `Other`

values which need to be totaled

```
| pointseries size="sum(percent)" color=color
| pie
```

And the you go. you have a pie chart with a giant `Other`

slice.

And what about the preview image. What application is that? Sort of looks ike Canvas and the Dev Tools console have been spending too much time together. What's up with the schedule tab? That's a story for another day.