# QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Not applicable

## To calculate Quantity based on Units

Hello Guys,

Looks very easy but I dont get it. Seems to be not my day. I just wanted to get the values of Quantity_in_kWh in the following example.

Hope someone can help.  See the attachment.

Sravan

4 Replies
MVP

## Re: To calculate Quantity based on Units

Hi

Your environment setting is for , (comma) as the decimal separator, but your data uses a . (period); so QV does not recognise your values as numbers,

Change

SET DecimalSep=',';

to

SET DecimalSep='.';

HTH

Jonathan

PS: you could use the number interpretation function rather than changing the environment, for example:

LOAD ...., Num#(Quantity, '#.#####', '.', ' ') As Quantity, ...

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Not applicable

## Re: To calculate Quantity based on Units

hi jonathan,

that does not solve the problem. I think I am making some silly mistake or overlooking something. why cant I multiply the Quantity and unit to get the Quantity_in_kWh?

MVP

## Re: To calculate Quantity based on Units

Hi

also replace this in your script

text(Quantity) as Quantity,

with

Quantity,

Regards

Contributor III

## Re: Re: To calculate Quantity based on Units

you'll have to use Jonathan's snippet for Quantity and Factor.

See attached