Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Unit of measure help!!!

I have a table that has products and the number of orders in liters. I have another table that the product name with the conversion between liters and cases. The problem is that one product can have the same number of liters but different number of cases. So the cases is really dependent on which product it is.


Table 1: Order by volume

Product, Orders

A, 10 L

B, 20 L

C, 40 L

D, 80 L


Table 2: Conversion table

Product, Liters, Cases

A, 10 L, 2 Cases

B, 10 L, 3 Cases

C, 10 L, 1 Cases

D, 10 L, 6 cases


I need the ability to be able to toggle between liters and cases. What can I do?


12 Replies
JonnyPoole
Employee
Employee

I created a conversion table by dividing Cases/liters for each product in the conversion table

Capture.PNG.png

-----------------

OrdersinLiters:

LOAD Product,

    [Orders (L)] as [Orders]

FROM

(txt, codepage is 1252, embedded labels, delimiter is ',', msq);

Conversion:

LOAD Product,

    Cases / Liters as [Product-LiterToCase-Conversion]

FROM

(txt, codepage is 1252, embedded labels, delimiter is ',', msq);

------------------

Then the chart expression for L and Cases is easy:

L:    sum(Orders)

Cases:  sum(Orders * [Product-LiterToCase-Conversion])

maxgro
MVP
MVP

PFA

1.png

Not applicable
Author

Thanks for the solutions guys.

What if I wanted a  button to switch from liters to cases without putting both cases and liter columns?

maxgro
MVP
MVP

one of  the possible solutions

JonnyPoole
Employee
Employee

one more solution....  (i feel like dueling banjos)

Capture.PNG.png

Capture.PNG.png

Not applicable
Author

These are looking great! One additional question, if I were to have one more unit of measure to toggle between. I need to now be able to move it from liters to barrels or cases


Say,


Table 1: Order by volume

Product, Orders

A, 10 L

B, 20 L

C, 40 L

D, 80 L


Table 2: Conversion table

Product, Liters, Cases, Barrels

A, 10 L, 2 Cases, 0.5 Barrel

B, 10 L, 3 Cases, .75

C, 10 L, 1 Cases, .25 Barrel

D, 10 L, 6 cases, 4.5 Barrel

JonnyPoole
Employee
Employee

Here is an updated version to handle Barrels as well.

Capture.PNG.png

maxgro
MVP
MVP

and my qvw  too

1.png

Not applicable
Author

Either of you know why my liter values are being doubled?