Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
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
Partner - Champion
Partner - Champion

use below:

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

Anonymous
Not applicable
Author

Hi Omkar,

Try with this below formula, it will work.

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

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

sunny_talwar

$ 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

Anonymous
Not applicable
Author

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
Contributor II
Contributor II

Hello,

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