Page 1 of 1

Rule to calculate based on dimension item (percentage)

Posted: Tue May 23, 2017 4:07 pm
by kenship
Hi, I have a dimension with a few percentages (100%, 50%, 25%, 0%) as recovery. Their element type are all simple.

I'm trying to get a calculation based on the said percentages but don't know how to refer to it on the right side. Right now I'm ruling it one by one such as:

['Recovery', '75%'] = N: ['Total Expenditure'] * 0.75;

I think there should be a way to rule it so that I don't have to rule every percentage, but don't know how.

Appreciate if someone can point out how to deal with it.

Thanks.

Kenneth

Re: Rule to calculate based on dimension item (percentage)

Posted: Tue May 23, 2017 4:43 pm
by Steve Rowe
Lets say your '75%' are in a the dimension Percentage

Then
['Recovery', '75%'] = N: ['Total Expenditure'] * Numbr(!Percentage);
this ought to simplify to
['Recovery'] = N: ['Total Expenditure'] * Numbr(!Percentage);

Alternatively (and I probably would) put a numeric attribute on the dimension
['Recovery'] = N: ['Total Expenditure'] * Attrn('Percentage , !Percentage , 'Percentage To Apply');

The above is (probably) not a great design. If want you want to do is really as simple as the above then consider creating an element called 'Recovery at 75%' and make Recovery a child of it with a weighting of 0.75. This will be more efficient calculation wise and you don't need another dimension to do it in.

Re: Rule to calculate based on dimension item (percentage)

Posted: Tue May 23, 2017 5:22 pm
by kenship
I tried NUMBR and for some reason it didn't work for me. I believe I used the wrong bracket.

I agree that using attribute is not the best idea, thought of it then dropped it.

So it's working now, thanks!