Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Not applicable

Dynamic Formula Calculation in Table

Hello All

I am reading one file which containing formulas for each row. In table I want to calculated each formula for each row in table.

Example

tblCounter

counterIDCounterNameCounterValue
1John10
2Smith12
3Ron23
4Rock23

tblFormula

formulaIDFormula
1sum(John(CounterValue)) +sum(Ron(CounterValue))
2sum(Smith(CounterValue)) +sum(Rock(CounterValue))

I want to show Table with Formula and its calculated value

Header 1Header 2
sum(John(CounterValue)) +sum(Ron(CounterValue))33
sum(Smith(CounterValue)) +sum(Rock(CounterValue))35

I have tried to add $ Expression in measure. But I am getting Blank value in Table.

5 Replies
agigliotti
Honored Contributor II

Re: Dynamic Formula Calculation in Table

use below:

sum( {< CounterName = {"John"} >} CounterValue )

lamnaresh
New Contributor II

Re: Dynamic Formula Calculation in Table

Hi Omkar,

Try with this below formula, it will work.

1. sum({$<CounterName={'John'}>+<CounterName={'Ron'}>}CounterValue)

2. sum({$<CounterName={'Smith'}>+<CounterName={'Rock'}>}CounterValue)

Re: Dynamic Formula Calculation in Table

$ sign expansion is probably not going to work as it doesn't work on row by row basis. May be you need to use Pick Match or if statement to get this done... don't understand this too well to give you a solution for the problem... may be post a sample

atkinsow
Valued Contributor II

Re: Dynamic Formula Calculation in Table

Not exactly sure what you need.  But you could try the following example

Assuming you're using inline tables your formula in the inline script would be (including the beginning and end double quotes)  Repeat for all the formulas you need.:

''sum({<CounterName={'''John'''}>}CounterValue)+'sum({<CounterName={'''Ron'''}>}CounterValue)'''

Then your dimension would be (Your header 1)

=$(=Formula)

and your Expression would be (Your header 2)

=$(=($(=Formula)))

Charles_Alter-SI
New Contributor II

Re: Dynamic Formula Calculation in Table

Hello,

Anyone came up with a solution since ? I have the same issue and none of the answers are working.

 

Community Browser