Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
amigo007
Contributor III
Contributor III

Dynamic calculation depending on filters

Hi,

I have one question about displaying dynamic calculation in the expression based on the values chosen from filters. For example:

Let's say I have one simple table which has simple multiplication calculation, e.g.

IDQuantityTotal
1100200
1200400
3300600

Suppose I have list box with the following selections:

a

b

c

When:

- I select 'a' the quantity in the rows should be mutiplied by 2 (as shown in the table above)

- I select 'b' the quantity in the rows should be mutiplied by 2,5. So the 'Total' for the 3 rows in the table above will be 500, 1000 and 1500 respectively.

- I select 'c' the quantity in the should be mutiplied by 6. The 'Total' for the 3 rows in the table above will be 1200, 2400 and 3600 respectively.

Is there a simple way to do that? Is there away to assign static numbers to values in the filters and use them dynamically in the expressions?

Thanks.

4 Replies
sangeess21
Creator
Creator

I'm not sure if I understood your question. Please check the attached example to see if it helps.

hallquist_nate
Partner - Creator III
Partner - Creator III

Hi-  I think one of the easiest ways to do this is to create a variable.  The variable would be an expression, like below....

vMultiplier=     IF(GetFieldSelections(List_Box Field)=a, 2,

                         IF(GetFieldSelections(List_Box Field)=b, 2.5,

                              IF(GetFieldSelections(List_Box Field)=c, 6,0)))

Then, I would write an expression for my total column like this...

=(FieldVlaue * vMultiplier)

This should allow you to have your dynamic multiplier based on a List Box selection, without having a large number of Conditional expressions to manage. 

Hope this helps,

Nate

trdandamudi
Master II
Master II

May be as below:

Dynamic_Calculation_Multiplier.jpg

amigo007
Contributor III
Contributor III
Author

Thanks guys for your great help, exactly what I needed.