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

multiplying values by percentage

I'm trying to figure out how I can multiply a value by different set of percentages which are in the tables.  Can somebody help?

1 Solution

Accepted Solutions
MarcoWedel

or with some more ratios:

table1:

CrossTable (ratioType, ratio, 2)

LOAD * INLINE [

    Month, Group, ratio1, ratio2, ratio3, ratio4

    Jan, A, 50%, 60%, 45%, 65%

    Jan, B, 50%, 40%, 70%, 85%

    Feb, A, 55%, 70%, 15%, 35%

    Feb, B, 45%, 30%, 25%, 90%

];

QlikCommunity_Thread_121684_Pic5.JPG.jpg

regards

Marco

View solution in original post

15 Replies
swuehl
MVP
MVP

Please provide some more details about these tables and where your value comes from.

Basically, QV can perform numeric operations, so multiplying percentages with values are simple:

=3 * 0.11

or formatted as you like, e.g.

=num(3*0.11, '00%')

Not applicable
Author

Basically, I have a table of percentages like

Month, Group, ratio1, ratio2

Jan, A, 50%, 60%

Jan, B, 50%, 40%

Feb, A, 55%, 70%

Feb, B, 45%, 30%

First, I want a selection box that will select between what ratio to use (ratio1 or ratio2).  Then, I want to use the ratio value based on the set of ratio selected in an expression.

I hope that helps to explain what I'm trying to do.

swuehl
MVP
MVP

And your values are in a fact table linked by Month and Group? Or just Group?

QV should be able to interpret your percentages correctly when read in, if not (check that the values are actually numbers, e.g. by checking the fields in table viewer or formatting a list box of rationX as number with decimals) use num#() function to interpret the values explicitely.

Then creating an expression should be simple, but maybe the complexity arise from the way your data is linked. So please post a more complete view on your data (Where are the values located and how are they linked to the above table).

Not applicable
Author

The expression is working but I'm trying to figure out a selection box to point which ratio to use whether it's ratio1 or ratio2.

Clever_Anjos
Employee
Employee

1) Create a small inline table with two values "Ratio1" and "Ratio2"

2) Add a listbox to your application

3) Select one value

4) Configure as "Always one selected" and "Windows Checkbox" style

5) Use an "if"

    sum(Value*if(newfield='Ratio1',Ratio1,Ratio2))

Clever_Anjos
Employee
Employee

PFA a small example

Not applicable
Author

Hi,

If you want to use ratio1 * ratio2 ... for example un a straigth table you can try an expresion like this:

(PurgeChar(ratio1,'%'))*Num(PurgeChar(ratio2,'%'))

PurgeChar function erase % simbol and you can use ratio1 and ratio2 as a number.

Best regards.

Not applicable
Author

How do you write #5 if there's more than two ratios?  What is the 'Value'?

Not applicable
Author

I'm not trying to multiply the ratios.  I have multiple sets of ratios and I'm trying to use it on a formula based on the selected set of ratios.