Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
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.

Thanks in Advance

Sravan

4 Replies
jonathandienst
Partner - Champion III
Partner - Champion III

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
Author

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?

maxgro
MVP
MVP

Hi

also replace this in your script

text(Quantity) as Quantity,

with

Quantity,

Regards

Anonymous
Not applicable
Author

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

See attached