4 Replies Latest reply: Aug 10, 2017 12:55 PM by Wallo Atkinson

# 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

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.

• ###### Re: Dynamic Formula Calculation in Table

use below:

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

• ###### 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

• ###### 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)'''