Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I have several calculations that I want to put into variables and they would need to accept a variable as a parameter.
E.g., I have a calculation as:
SUM( {< $(vLatestMonth), FLAG = {'Y'} >} AMOUNT_1 ) / SUM ( {< $(vLatestMonth), FLAG = {'Y'} >} AMOUNT_2 )
/
SUM( {< $(vPrevMonth), FLAG = {'Y'} >} AMOUNT_1 ) / SUM ( {< $(vPrevMonth), FLAG = {'Y'} >} AMOUNT_2 )
And I want to define a variable for that calculation:
vMetric(@)= SUM( {< @, FLAG = {'Y'} >} AMOUNT_1 ) / SUM ( {< @, FLAG = {'Y'} >} AMOUNT_2 )
And then use the variable in a chart by passing in another variable containing some set analysis:
$(vMetric (vLatestMonth) ) / $(vMetric( vPrevMonth ) )
If that is possible, what is the correct syntax?
Thanks,
Rutger
It looked quite ok. unless some small syntax-issues and should work if your vLatest/PrevMonth variables contain a valid set analysis statement - and that there is no comma included which is always regarded as a parameter-delimiter. Therefore try this:
vMetric:
SUM( {< $1, FLAG = {'Y'} >} AMOUNT_1 ) / SUM ( {< $1, FLAG = {'Y'} >} AMOUNT_2 )
$(vMetric (vLatestMonth)) / $(vMetric(vPrevMonth))
- Marcus
It looked quite ok. unless some small syntax-issues and should work if your vLatest/PrevMonth variables contain a valid set analysis statement - and that there is no comma included which is always regarded as a parameter-delimiter. Therefore try this:
vMetric:
SUM( {< $1, FLAG = {'Y'} >} AMOUNT_1 ) / SUM ( {< $1, FLAG = {'Y'} >} AMOUNT_2 )
$(vMetric (vLatestMonth)) / $(vMetric(vPrevMonth))
- Marcus
Hi rugerm when calling a variable you can pass different parameters, each one spearated by commas:
var(parameter1, parameter2)
Then $1 is used to get the first parameter, $2 for the second, etc.. So i think that vMetric should be:
SUM( {< $($1), FLAG = {'Y'} >} AMOUNT_1 ) / SUM ( {< $($1), FLAG = {'Y'} >} AMOUNT_2 )
Hi i am start in this, you can help me ?
Thanks very much Marcus
Thanks Ruben, much appreciated
I can try, what is your question? Maybe it's better to create a new 'discussion' for the community? Go to your login > Inbox/Activity > Discussion >