2 Replies Latest reply: Aug 18, 2014 7:30 PM by Marco Wedel

# Calculation in script and number format

I have two questions.

1) I have a field that comes in as 199.00 instead of 1.99 so I put it as an expression in a chart and divided it by 100 to see it as 1.99 but I want to see this as a percent so when I set it as a "Fixed to 2 decimals" and "Show it as a percent" , it shows me 199.00%. Any way to fix this in the expression calculation or script? I want to be able to see 1.99%

1) Is there an easy way to do a sum calculation in the script?  I have a field that is extracted in seconds but I need it in hours. So I want to be able to calculate this in the script for performance reasons. The below seems to be unacceptable. How can I do this in the script without making it overly complicated?

Speed,

Speed/2600 as [Speedhours],                                    // doesn't seem to get the right answer

SUM(Speed/3600) as [Speed in hours],                    //  doesn't work, errors

Otherfields,

Otherfields1,

From **

• ###### Re: Calculation in script and number format

1 - Try dividing it by 10,000 instead

2 - In order to do sum's (aggregations), you need to group by all the fields that are not part of the sum.

Group By

Speed,

Otherfields,

Otherfields1

That way you can sum at the correct level.

• ###### Re: Calculation in script and number format

Hi,

```LOAD
Num(field1/100, '0.00%') as field1,
Speed,
Speed/3600 as [Speed in hours]
Inline [
field1, Speed
199.00, 10
];
```

hope this helps

regards

Marco