Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Unit of measure conversion help

I need help with converting units of measure. I need the ability to see the measures in litres or cases.

Currently, all my measures are coming into Qlikview with the hectolitre measurement. It is easy for me to change all of it to litres because it is a 1 to 1 relationship between litres and hectolitres. However, I have different conversion to change it into cases because each package has a different conversion.

I have a table that gives me the conversion for each product in liters and cases. What is the best way to convert this or do this so that I have the ability to change the coming numbers from hectolitres to cases or liters.

5 Replies
crusader_
Partner - Specialist
Partner - Specialist

Hi,

Use mapping load of your Conversion table for each product (if it has format Product - Conversion) and ApplyMap() function in script to create new field cases. The same thing with litres.

In the end you will get all possible formats (hectolitres/litres/cases) in different fields and then you'll be able to use all of them as you want.

Hope this helps.

Andrei

Not applicable
Author

do you have an example app for this? i'm not familiar with ApplyMap function..that's why

demoustier
Creator
Creator

Hi,

Use Mapping Load and Apply Map function.

Post your conversion table for example

demoustier
Creator
Creator

Hi,

I suppose you have a Data Table with your Product, Quantity and Unit. Somethoing like this:

Data

ProductUnitQty
waterbottle6
alchoolliter5
juicepieces45

You should also have a table with correspondance between Unit and your final measurmentrequired like below:

transco:

UnitIn liter
bottle5
liter1
pieces12

so you can use Aplly Map function:

Mapping

transco:

Load * resident transco;

Load

Product,

Qty*ApplyMap('transco',Unit) as Qty_in_liter

resident Data;

crusader_
Partner - Specialist
Partner - Specialist

Small example:

some_map:

MAPPING LOAD * INLINE [

Product, Litres

milk, 1.3

fuel, 1.4

gas, 0.9

];

Table:

LOAD *

  , ApplyMap('some_map',Product,0)*Hectalitres as Litres //Means Hectalitres*convertion=Litres

  ;

LOAD * INLINE [

Product, Hectalitres

milk, 1400

fuel, 900

gas, 833

];

I used Precending LOAD with Applymap function - the best way to escape several useless same resident loads.

Hope this helps.

Andrei